Use UploadedImage to check image correctness and better error responses

This commit is contained in:
2025-04-09 22:15:12 +02:00
parent 67bc49fb21
commit 6e39b59dd5
4 changed files with 42 additions and 29 deletions

View File

@ -306,19 +306,19 @@ def test_apply_rights_recursively():
SimpleUploadedFile(
"test.jpg", content=b"invalid", content_type="image/jpg"
),
415,
422,
),
(
lambda: old_subscriber_user.make(),
SimpleUploadedFile(
"test.jpg", content=RED_PIXEL_PNG, content_type="invalid"
),
415,
200, # PIL can guess
),
(
lambda: old_subscriber_user.make(),
SimpleUploadedFile("test.jpg", content=b"invalid", content_type="invalid"),
415,
422,
),
],
)