From 53d65398ce1d8e067fb25ddd7a487a83cadd94cf Mon Sep 17 00:00:00 2001 From: Cyperghost Date: Wed, 6 Nov 2024 09:26:55 +0100 Subject: [PATCH] Validate the file type --- ts/WoltLabSuite/Core/Component/Image/Cropper.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ts/WoltLabSuite/Core/Component/Image/Cropper.ts b/ts/WoltLabSuite/Core/Component/Image/Cropper.ts index c0a5fc35a7..d77a980f31 100644 --- a/ts/WoltLabSuite/Core/Component/Image/Cropper.ts +++ b/ts/WoltLabSuite/Core/Component/Image/Cropper.ts @@ -253,6 +253,18 @@ export async function cropImage( file: File, configuration: CropperConfiguration, ): Promise { + switch (file.type) { + case "image/jpeg": + case "image/png": + case "image/webp": + // Potential candidate for a resize operation. + break; + + default: + // Not an image or an unsupported file type. + return file; + } + let imageCropper: ImageCropper; switch (configuration.type) { case "exact": -- 2.20.1