Composer: Support non-standard JPG extensions (#1517)

This commit is contained in:
Alexander Zinchuk 2021-10-28 15:50:54 +03:00
parent b3e96a51c7
commit ff16a6411b

View File

@ -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<ApiAttachment>,
@ -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;