Message: Fix "No file" error when downloading media (#2001)

This commit is contained in:
Alexander Zinchuk 2022-08-18 16:16:25 +02:00
parent 4b7b72592e
commit 43fa66eb61

View File

@ -317,9 +317,12 @@ export function getMessageMediaFormat(
} = message.content; } = message.content;
const fullVideo = video || getMessageWebPageVideo(message); const fullVideo = video || getMessageWebPageVideo(message);
const size = (video || audio || document)?.size!; const size = (video || audio || document)?.size!;
if (target === 'download' && IS_PROGRESSIVE_SUPPORTED && size > MAX_BUFFER_SIZE && !IS_OPFS_SUPPORTED) { if (target === 'download') {
if (IS_PROGRESSIVE_SUPPORTED && size > MAX_BUFFER_SIZE && !IS_OPFS_SUPPORTED) {
return ApiMediaFormat.DownloadUrl; return ApiMediaFormat.DownloadUrl;
} }
return ApiMediaFormat.BlobUrl;
}
if (fullVideo && IS_PROGRESSIVE_SUPPORTED && ( if (fullVideo && IS_PROGRESSIVE_SUPPORTED && (
target === 'viewerFull' || target === 'inline' target === 'viewerFull' || target === 'inline'