mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-09-13 14:22:25 +03:00
fix(thumbnail): fallback doesn't work in encrypt room
This commit is contained in:
parent
3dc08abfed
commit
09e445453c
1 changed files with 7 additions and 3 deletions
|
@ -96,9 +96,13 @@ export const ImageContent = as<'div', ImageContentProps>(
|
||||||
useCallback(async () => {
|
useCallback(async () => {
|
||||||
const mediaUrl = (useThumbnail ? mxcUrlToHttp(mx, url, useAuthentication, imgWidth, imgHeight, resizeMethod) : mxcUrlToHttp(mx, url, useAuthentication)) ?? url;
|
const mediaUrl = (useThumbnail ? mxcUrlToHttp(mx, url, useAuthentication, imgWidth, imgHeight, resizeMethod) : mxcUrlToHttp(mx, url, useAuthentication)) ?? url;
|
||||||
if (encInfo) {
|
if (encInfo) {
|
||||||
const fileContent = await downloadEncryptedMedia(mediaUrl, (encBuf) =>
|
const decrypt = (encBuf: ArrayBuffer) => decryptFile(encBuf, mimeType ?? FALLBACK_MIMETYPE, encInfo);
|
||||||
decryptFile(encBuf, mimeType ?? FALLBACK_MIMETYPE, encInfo)
|
let fileContent;
|
||||||
);
|
try {
|
||||||
|
fileContent = await downloadEncryptedMedia(mediaUrl, decrypt);
|
||||||
|
} catch {
|
||||||
|
fileContent = await downloadEncryptedMedia(mxcUrlToHttp(mx, url, useAuthentication) ?? url, decrypt);
|
||||||
|
}
|
||||||
return URL.createObjectURL(fileContent);
|
return URL.createObjectURL(fileContent);
|
||||||
}
|
}
|
||||||
return mediaUrl;
|
return mediaUrl;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue