use the mimetype from the info property rather than the EncryptedFile
the mimetype in EncryptedFile is undocumented and redundant. see https://github.com/matrix-org/matrix-doc/pull/2582
This commit is contained in:
parent
d7cb855419
commit
3b9810719f
3 changed files with 26 additions and 13 deletions
|
@ -76,7 +76,8 @@ export class MediaEventHelper implements IDestroyable {
|
|||
|
||||
private fetchSource = () => {
|
||||
if (this.media.isEncrypted) {
|
||||
return decryptFile(this.event.getContent<IMediaEventContent>().file);
|
||||
const content = this.event.getContent<IMediaEventContent>();
|
||||
return decryptFile(content.file, content.info);
|
||||
}
|
||||
return this.media.downloadSource().then(r => r.blob());
|
||||
};
|
||||
|
@ -87,7 +88,7 @@ export class MediaEventHelper implements IDestroyable {
|
|||
if (this.media.isEncrypted) {
|
||||
const content = this.event.getContent<IMediaEventContent>();
|
||||
if (content.info?.thumbnail_file) {
|
||||
return decryptFile(content.info.thumbnail_file);
|
||||
return decryptFile(content.info.thumbnail_file, content.info.thumbnail_info);
|
||||
} else {
|
||||
// "Should never happen"
|
||||
console.warn("Media claims to have thumbnail and is encrypted, but no thumbnail_file found");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue