From ff16a6411b0218a9f279f71bcaf6e8948ad6a02e Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Thu, 28 Oct 2021 15:50:54 +0300 Subject: [PATCH] Composer: Support non-standard JPG extensions (#1517) --- src/components/middle/composer/helpers/buildAttachment.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/middle/composer/helpers/buildAttachment.ts b/src/components/middle/composer/helpers/buildAttachment.ts index 94ef5cf0..13862f47 100644 --- a/src/components/middle/composer/helpers/buildAttachment.ts +++ b/src/components/middle/composer/helpers/buildAttachment.ts @@ -9,6 +9,7 @@ import { import { scaleImage } from '../../../../util/imageResize'; const MAX_QUICK_IMG_SIZE = 1280; // px +const FILE_EXT_REGEX = /\.[^/.]+$/; export default async function buildAttachment( filename: string, blob: Blob, isQuick: boolean, options?: Partial, @@ -30,6 +31,10 @@ export default async function buildAttachment( return buildAttachment(filename, newBlob, true, options); } + if (mimeType === 'image/jpeg') { + filename = filename.replace(FILE_EXT_REGEX, '.jpg'); + } + quick = { width, height }; } else { previewBlobUrl = blobUrl;