fix: process stops if image preview or thumbnail creation fails

This commit is contained in:
schlagmichdoch 2023-02-08 14:10:34 +01:00
parent a0ba46caf4
commit 671dfa1c87
2 changed files with 8 additions and 5 deletions

View file

@ -516,10 +516,12 @@ class ReceiveFileDialog extends ReceiveDialog {
element.src = URL.createObjectURL(file);
element.controls = true;
element.classList.add('element-preview');
this.$previewBox.appendChild(element)
element.onload = _ => resolve(true);
element.onload = _ => {
this.$previewBox.appendChild(element);
resolve(true)
};
element.addEventListener('loadeddata', _ => resolve(true));
element.onerror = _ => reject(`${mime} preview could not be loaded`);
element.onerror = _ => reject(`${mime} preview could not be loaded from type ${file.type}`);
}
});
}