A damaged image is refused in words, not with a 500 (#1065) #1066
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/map-upload-500"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #1065.
Summary
An image whose header reads but whose pixel data is broken answered
500 {"detail":"Internal server error"}.image_service.validate_and_reencodeguarded onlyImage.openandverify(); the pixels are decoded later, in the re-encode, which was outside thetry. The re-encode is now inside the guard and raisesImageError("This image is damaged or incomplete, so it could not be read."), which every caller (map images, page pictures, attachments, imports) already turns into a 422.Found while reproducing a map-upload 500 in the journeys stack. A sound image uploads and tiles correctly there; of 23 variants tried, only the three damaged ones gave a 500.
Changelog
changelog.d/damaged-image-upload-500.fixed.mdTest plan
OSErroras the live traceback.test_damaged_image_upload.py, a route test intests/wiki/test_maps_api.py(422, no image kept,tiles_status"none"), plustests/wiki,tests/exportand the enqueue tests: 865 passed.readyand served its tile. A 4.1 MB PNG returned 200 through nginx, which confirms #1058's limit in a running build.🤖 Generated with Claude Code