Composer: Support non-standard JPG extensions (#1517)
This commit is contained in:
parent
b3e96a51c7
commit
ff16a6411b
@ -9,6 +9,7 @@ import {
|
|||||||
import { scaleImage } from '../../../../util/imageResize';
|
import { scaleImage } from '../../../../util/imageResize';
|
||||||
|
|
||||||
const MAX_QUICK_IMG_SIZE = 1280; // px
|
const MAX_QUICK_IMG_SIZE = 1280; // px
|
||||||
|
const FILE_EXT_REGEX = /\.[^/.]+$/;
|
||||||
|
|
||||||
export default async function buildAttachment(
|
export default async function buildAttachment(
|
||||||
filename: string, blob: Blob, isQuick: boolean, options?: Partial<ApiAttachment>,
|
filename: string, blob: Blob, isQuick: boolean, options?: Partial<ApiAttachment>,
|
||||||
@ -30,6 +31,10 @@ export default async function buildAttachment(
|
|||||||
return buildAttachment(filename, newBlob, true, options);
|
return buildAttachment(filename, newBlob, true, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mimeType === 'image/jpeg') {
|
||||||
|
filename = filename.replace(FILE_EXT_REGEX, '.jpg');
|
||||||
|
}
|
||||||
|
|
||||||
quick = { width, height };
|
quick = { width, height };
|
||||||
} else {
|
} else {
|
||||||
previewBlobUrl = blobUrl;
|
previewBlobUrl = blobUrl;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user