Skip to content

Commit 94780c4

Browse files
committed
handle-external-link: Ignore invalid URLs.
Signed-off-by: Anders Kaseorg <[email protected]>
1 parent 82542a6 commit 94780c4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

app/main/handle-external-link.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,13 @@ export default function handleExternalLink(
105105
details: HandlerDetails,
106106
mainContents: WebContents,
107107
): void {
108-
const url = new URL(details.url);
108+
let url: URL;
109+
try {
110+
url = new URL(details.url);
111+
} catch {
112+
return;
113+
}
114+
109115
const downloadPath = ConfigUtil.getConfigItem(
110116
"downloadsPath",
111117
`${app.getPath("downloads")}`,

0 commit comments

Comments
 (0)