Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Media validation - extend MIME type allowlist (#18828)
Przemysław Ładad361479ab7da
diff --git a/saleor/graphql/core/tests/test_file_validation.py b/saleor/graphql/core/tests/test_file_validation.pyindex 09e8ca88ab..be999bc824 100644--- a/saleor/graphql/core/tests/test_file_validation.py+++ b/saleor/graphql/core/tests/test_file_validation.py@@ -67,6 +67,7 @@ def test_is_supported_image_mimetype_invalid_mimetype():("content_type", "is_valid"),[("image/jpeg", True),+ ("image/jpg", True),("image/png", True),("image/gif", True),("image/bmp", True),diff --git a/saleor/thumbnail/__init__.py b/saleor/thumbnail/__init__.pyindex d83267c0a5..09252d4406 100644--- a/saleor/thumbnail/__init__.py+++ b/saleor/thumbnail/__init__.py@@ -30,6 +30,7 @@ MIME_TYPE_TO_PIL_IDENTIFIER = {"image/eps": "EPS","image/gif": "GIF","image/jpeg": "JPEG",+ "image/jpg": "JPEG", # Invalid MIME for JPEG but some servers return it"image/pcd": "PCD","image/pcx": "PCX","image/png": "PNG",diff --git a/saleor/thumbnail/tests/test_utils.py b/saleor/thumbnail/tests/test_utils.pyindex 1686210a9f..94905d50d7 100644--- a/saleor/thumbnail/tests/test_utils.py+++ b/saleor/thumbnail/tests/test_utils.py@@ -219,6 +219,7 @@ def test_get_filename_from_url_with_query_params_path(mock_token_hex):("url", "mimetype", "expected_extension"),[("http://example.com/image", "image/jpeg", ".jpg"),+ ("http://example.com/image", "image/jpg", ".jpg"),("http://example.com/image", "image/png", ".png"),("http://example.com/image?token=12345/6789", "image/webp", ".webp"),],