Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

fix(export): defer URL.revokeObjectURL after triggering a download

AronMav7496b9dab88e
diff --git a/apps/server/AliasVault.Client/wwwroot/js/utilities.js b/apps/server/AliasVault.Client/wwwroot/js/utilities.js
index ef13c29fa..ef8210639 100644
--- a/apps/server/AliasVault.Client/wwwroot/js/utilities.js
+++ b/apps/server/AliasVault.Client/wwwroot/js/utilities.js
@@ -5,9 +5,13 @@ function downloadFileFromStream(fileName, contentStreamReference) {
const anchorElement = document.createElement('a');
anchorElement.href = url;
anchorElement.download = fileName ?? '';
+ document.body.appendChild(anchorElement);
anchorElement.click();
anchorElement.remove();
- URL.revokeObjectURL(url);
+ // Defer revocation: some browsers (Firefox, Safari, and Chrome with large blobs)
+ // need the object URL to remain valid after click() returns, because the download
+ // is queued asynchronously. Revoking immediately causes a silent download failure.
+ setTimeout(() => URL.revokeObjectURL(url), 10000);
}
window.topMenuClickOutsideHandler = (dotNetHelper) => {