Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
lowercase file extension before validation
raghu77735a45d369187
diff --git a/saleor/graphql/core/tests/test_file_validation.py b/saleor/graphql/core/tests/test_file_validation.pyindex cf80e6748e..973a9667a4 100644--- a/saleor/graphql/core/tests/test_file_validation.py+++ b/saleor/graphql/core/tests/test_file_validation.py@@ -288,3 +288,16 @@ def test_clean_image_file_invalid_image_mime_type(from_buffer_mock):# thenerror_msg = f"Unsupported image MIME type: {invalid_mime_type}"assert error_msg in exc.value.args[0][field].message+++def test_clean_image_file_with_captialized_extension():+ # given+ img_data = BytesIO()+ image = Image.new("RGB", size=(1, 1))+ image.save(img_data, format="JPEG")+ field = "image"++ img = SimpleUploadedFile("product.JPG", img_data.getvalue(), "image/jpeg")++ # when & then+ clean_image_file({field: img}, field, ProductErrorCode)diff --git a/saleor/graphql/core/validators/file.py b/saleor/graphql/core/validators/file.pyindex 0b536f9149..8c1ae6d896 100644--- a/saleor/graphql/core/validators/file.py+++ b/saleor/graphql/core/validators/file.py@@ -113,7 +113,7 @@ def _validate_image_format(file, field_name, error_class):)})- elif format not in allowed_extensions:+ elif format.lower() not in allowed_extensions:raise ValidationError({field_name: ValidationError(