Only revoke object URLs we created
This commit is contained in:
parent
c6599d2e14
commit
110b58230b
1 changed files with 4 additions and 1 deletions
|
@ -55,6 +55,7 @@ export const save = ({
|
||||||
getAbsolutePath: (relativePath: string) => string;
|
getAbsolutePath: (relativePath: string) => string;
|
||||||
timestamp?: number;
|
timestamp?: number;
|
||||||
}): void => {
|
}): void => {
|
||||||
|
const isObjectURLRequired = is.undefined(attachment.path);
|
||||||
const url = !is.undefined(attachment.path)
|
const url = !is.undefined(attachment.path)
|
||||||
? getAbsolutePath(attachment.path)
|
? getAbsolutePath(attachment.path)
|
||||||
: arrayBufferToObjectURL({
|
: arrayBufferToObjectURL({
|
||||||
|
@ -63,7 +64,9 @@ export const save = ({
|
||||||
});
|
});
|
||||||
const filename = getSuggestedFilename({ attachment, timestamp });
|
const filename = getSuggestedFilename({ attachment, timestamp });
|
||||||
saveURLAsFile({ url, filename, document });
|
saveURLAsFile({ url, filename, document });
|
||||||
URL.revokeObjectURL(url);
|
if (isObjectURLRequired) {
|
||||||
|
URL.revokeObjectURL(url);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getSuggestedFilename = ({
|
export const getSuggestedFilename = ({
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue