mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
clean up properly
This commit is contained in:
parent
d14f485292
commit
c65e8bea11
@ -12,6 +12,7 @@
|
|||||||
link.href = url;
|
link.href = url;
|
||||||
link.download = filename;
|
link.download = filename;
|
||||||
link.click();
|
link.click();
|
||||||
|
URL.revokeObjectURL(url);
|
||||||
}
|
}
|
||||||
window.addEventListener("message", function(event) {
|
window.addEventListener("message", function(event) {
|
||||||
if (event.data.type === "download") {
|
if (event.data.type === "download") {
|
||||||
|
@ -33,12 +33,14 @@ export class FileTile extends MessageTile {
|
|||||||
const filename = content.body;
|
const filename = content.body;
|
||||||
this._downloading = true;
|
this._downloading = true;
|
||||||
this.emitChange("label");
|
this.emitChange("label");
|
||||||
|
let bufferHandle;
|
||||||
try {
|
try {
|
||||||
const bufferHandle = await this._mediaRepository.downloadAttachment(content);
|
bufferHandle = await this._mediaRepository.downloadAttachment(content);
|
||||||
this.platform.offerSaveBufferHandle(bufferHandle, filename);
|
this.platform.offerSaveBufferHandle(bufferHandle, filename);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this._error = err;
|
this._error = err;
|
||||||
} finally {
|
} finally {
|
||||||
|
bufferHandle?.dispose();
|
||||||
this._downloading = false;
|
this._downloading = false;
|
||||||
}
|
}
|
||||||
this.emitChange("label");
|
this.emitChange("label");
|
||||||
|
Loading…
Reference in New Issue
Block a user