Skip to content

Commit

Permalink
fix(CLI): allow to download and open any http/https publication URL f…
Browse files Browse the repository at this point in the history
…rom CLI command (Fixes #2665)
  • Loading branch information
panaC committed Nov 18, 2024
1 parent def34e9 commit 57a79dd
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/main/cli/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,22 @@ export const setOpenUrl = (url: string): void => {
}

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

const buf = getOpenUrlWithThoriumSchemeEventChannel();
buf.put(openUrl);
}

// only from the CLI we accept http/https protocols
else if (url.startsWith("http://") || url.startsWith("https://")) {
const openUrl = url;

const buf = getOpenUrlWithThoriumSchemeEventChannel();
buf.put(openUrl);
}

else {
process.stderr.write("Cannot open URL with this protocol");
}
};

0 comments on commit 57a79dd

Please sign in to comment.