Skip to content

best way to save what you love

web/download: do not show additional dialog on top of dialog in openURL

jjae518692edc4
diff --git a/web/src/components/dialog/SavingDialog.svelte b/web/src/components/dialog/SavingDialog.svelte
index 8a391c8c..6fa1ed49 100644
--- a/web/src/components/dialog/SavingDialog.svelte
+++ b/web/src/components/dialog/SavingDialog.svelte
@@ -69,7 +69,7 @@
if (file) {
return openFile(file);
} else if (url) {
- return openURL(url);
+ return openURL(url, true);
}
}}
>
diff --git a/web/src/lib/download.ts b/web/src/lib/download.ts
index 0bb04510..efcf50ee 100644
--- a/web/src/lib/download.ts
+++ b/web/src/lib/download.ts
@@ -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")