Skip to content

best way to save what you love

web/download: don't try to open non-https links

jjc4be1d3a37b0
diff --git a/web/src/lib/download.ts b/web/src/lib/download.ts
index 9cfbf630..7a126a92 100644
--- a/web/src/lib/download.ts
+++ b/web/src/lib/download.ts
@@ -56,6 +56,10 @@ export const shareFile = async (file: File) => {
}
export const openURL = (url: string) => {
+ if (!['http:', 'https:'].includes(new URL(url).protocol)) {
+ return alert('error: invalid url!');
+ }
+
const open = window.open(url, "_blank");
/* if new tab got blocked by user agent, show a saving dialog */