web/download: don't try to open non-https links
This commit is contained in:
parent
b125894b7e
commit
c4be1d3a37
1 changed files with 4 additions and 0 deletions
|
@ -56,6 +56,10 @@ export const shareFile = async (file: File) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const openURL = (url: string) => {
|
export const openURL = (url: string) => {
|
||||||
|
if (!['http:', 'https:'].includes(new URL(url).protocol)) {
|
||||||
|
return alert('error: invalid url!');
|
||||||
|
}
|
||||||
|
|
||||||
const open = window.open(url, "_blank");
|
const open = window.open(url, "_blank");
|
||||||
|
|
||||||
/* if new tab got blocked by user agent, show a saving dialog */
|
/* if new tab got blocked by user agent, show a saving dialog */
|
||||||
|
|
Loading…
Reference in a new issue