mirror of
https://github.com/imputnet/cobalt.git
synced 2025-12-23 08:28:52 +00:00
web/download: do not show additional dialog on top of dialog in openURL
This commit is contained in:
@@ -69,7 +69,7 @@
|
||||
if (file) {
|
||||
return openFile(file);
|
||||
} else if (url) {
|
||||
return openURL(url);
|
||||
return openURL(url, true);
|
||||
}
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -51,7 +51,7 @@ export const shareFile = async (file: File) => {
|
||||
});
|
||||
}
|
||||
|
||||
export const openURL = (url: string) => {
|
||||
export const openURL = (url: string, hasDialog = false) => {
|
||||
if (!['http:', 'https:'].includes(new URL(url).protocol)) {
|
||||
return alert('error: invalid url!');
|
||||
}
|
||||
@@ -59,7 +59,7 @@ export const openURL = (url: string) => {
|
||||
const open = window.open(url, "_blank", "noopener,noreferrer");
|
||||
|
||||
/* if new tab got blocked by user agent, show a saving dialog */
|
||||
if (!open) {
|
||||
if (!open && !hasDialog) {
|
||||
return openSavingDialog({
|
||||
url,
|
||||
body: get(t)("dialog.saving.blocked")
|
||||
|
||||
Reference in New Issue
Block a user