From 110b58230b01f9b99f3616f752f6525993caa98c Mon Sep 17 00:00:00 2001 From: Daniel Gasienica Date: Mon, 30 Apr 2018 11:01:57 -0400 Subject: [PATCH] Only revoke object URLs we created --- ts/types/Attachment.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ts/types/Attachment.ts b/ts/types/Attachment.ts index 55351a5eb..3578f1b4e 100644 --- a/ts/types/Attachment.ts +++ b/ts/types/Attachment.ts @@ -55,6 +55,7 @@ export const save = ({ getAbsolutePath: (relativePath: string) => string; timestamp?: number; }): void => { + const isObjectURLRequired = is.undefined(attachment.path); const url = !is.undefined(attachment.path) ? getAbsolutePath(attachment.path) : arrayBufferToObjectURL({ @@ -63,7 +64,9 @@ export const save = ({ }); const filename = getSuggestedFilename({ attachment, timestamp }); saveURLAsFile({ url, filename, document }); - URL.revokeObjectURL(url); + if (isObjectURLRequired) { + URL.revokeObjectURL(url); + } }; export const getSuggestedFilename = ({