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

This commit is contained in:
jj
2024-10-30 13:17:38 +00:00
parent b125894b7e
commit c4be1d3a37

View File

@ -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 */