store error when loading encrypted images

This commit is contained in:
Bruno Windels 2020-10-27 16:21:08 +01:00
parent e7ff6decbf
commit 97c3a4b8f3

View File

@ -24,6 +24,7 @@ export class ImageTile extends MessageTile {
super(options); super(options);
this._decryptedThumbail = null; this._decryptedThumbail = null;
this._decryptedImage = null; this._decryptedImage = null;
this._error = null;
this.load(); this.load();
} }
@ -36,14 +37,18 @@ export class ImageTile extends MessageTile {
} }
async load() { async load() {
const thumbnailFile = this._getContent().info?.thumbnail_file; try {
const file = this._getContent().file; const thumbnailFile = this._getContent().info?.thumbnail_file;
if (thumbnailFile) { const file = this._getContent().file;
this._decryptedThumbail = await this._loadEncryptedFile(thumbnailFile); if (thumbnailFile) {
this.emitChange("thumbnailUrl"); this._decryptedThumbail = await this._loadEncryptedFile(thumbnailFile);
} else if (file) { this.emitChange("thumbnailUrl");
this._decryptedImage = await this._loadEncryptedFile(file); } else if (file) {
this.emitChange("thumbnailUrl"); this._decryptedImage = await this._loadEncryptedFile(file);
this.emitChange("thumbnailUrl");
}
} catch (err) {
this._error = err;
} }
} }