diff --git a/web/src/engine/websites/decorators/Common.ts b/web/src/engine/websites/decorators/Common.ts index 89e1cb4fca..b1eef5368e 100644 --- a/web/src/engine/websites/decorators/Common.ts +++ b/web/src/engine/websites/decorators/Common.ts @@ -559,8 +559,8 @@ export function ImageAjaxFromHTML(queryImage: string, detectMimeType = false, de /** * A helper function to detect and get the mime typed image data of a buffer. */ -export async function GetTypedData(buffer: ArrayBuffer): Promise { - const bytes = new Uint8Array(buffer); +export async function GetTypedData(buffer: ArrayBuffer | Uint8Array): Promise { + const bytes = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer); // WEBP [52 49 46 46 . . . . 57 45 42 50] if (bytes[8] === 0x57 && bytes[9] === 0x45 && bytes[10] === 0x42 && bytes[11] === 0x50) { return new Blob([bytes], { type: 'image/webp' });