Skip to content

Commit 57a79dd

Browse files
committed
fix(CLI): allow to download and open any http/https publication URL from CLI command (Fixes #2665)
1 parent def34e9 commit 57a79dd

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/main/cli/url.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,22 @@ export const setOpenUrl = (url: string): void => {
2727
}
2828

2929
// OR: if (new URL(url).protocol === "thorium:")
30-
if (url.startsWith("thorium://")) {
30+
else if (url.startsWith("thorium://")) {
3131
const openUrl = url.replace("thorium://", "http://"); // HTTP to HTTPS redirect should be handled by the server
3232

3333
const buf = getOpenUrlWithThoriumSchemeEventChannel();
3434
buf.put(openUrl);
3535
}
3636

37+
// only from the CLI we accept http/https protocols
38+
else if (url.startsWith("http://") || url.startsWith("https://")) {
39+
const openUrl = url;
40+
41+
const buf = getOpenUrlWithThoriumSchemeEventChannel();
42+
buf.put(openUrl);
43+
}
44+
45+
else {
46+
process.stderr.write("Cannot open URL with this protocol");
47+
}
3748
};

0 commit comments

Comments
 (0)