From 43fa66eb615ac9b5e8bf8243ffd6cf96c621cd78 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Thu, 18 Aug 2022 16:16:25 +0200 Subject: [PATCH] Message: Fix "No file" error when downloading media (#2001) --- src/global/helpers/messageMedia.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/global/helpers/messageMedia.ts b/src/global/helpers/messageMedia.ts index 015773fbb..aafdad6bc 100644 --- a/src/global/helpers/messageMedia.ts +++ b/src/global/helpers/messageMedia.ts @@ -317,8 +317,11 @@ export function getMessageMediaFormat( } = message.content; const fullVideo = video || getMessageWebPageVideo(message); const size = (video || audio || document)?.size!; - if (target === 'download' && IS_PROGRESSIVE_SUPPORTED && size > MAX_BUFFER_SIZE && !IS_OPFS_SUPPORTED) { - return ApiMediaFormat.DownloadUrl; + if (target === 'download') { + if (IS_PROGRESSIVE_SUPPORTED && size > MAX_BUFFER_SIZE && !IS_OPFS_SUPPORTED) { + return ApiMediaFormat.DownloadUrl; + } + return ApiMediaFormat.BlobUrl; } if (fullVideo && IS_PROGRESSIVE_SUPPORTED && (