From: Cyperghost Date: Wed, 6 Nov 2024 08:26:55 +0000 (+0100) Subject: Validate the file type X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=53d65398ce1d8e067fb25ddd7a487a83cadd94cf;p=GitHub%2FWoltLab%2FWCF.git Validate the file type --- 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":