Repository navigation
Fix the response to a geometry that has no pixels - #113
Merged
Merged
Conversation
A crop offset at the image edge ended the request with 500. An offset past the edge produced an image of one pixel. go-dims responds with 400 status code for both. - Respond with 400 status code for a crop region that lies off the image. - Respond with 400 status code when MagickCropImage fails. The status was 500. - Fill a crop side of zero from the image before the cut. - Clamp a resize and a watermark overlay to one pixel a side.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The module returns 400 status code for a crop region that lies off the image, and for a crop where MagickCropImage fails. A crop side of zero is filled from the image before the cut. A resize and a watermark overlay hold a minimum of one pixel a side.
Why
Five geometries with no pixels ended the request with a 500 status or an image of one pixel.
crop/256x256+768+768on 512x512crop/50x50+512+0on 512x512crop/1247x591+149+108/legacy_thumbnail/x1070/crop/895x648on 200x136resize/1x1!/resize/46%watermark/0.2,0.8,neon a 1x1 sourceRow two covers one offset. An offset of 511 returned 200. An offset of 513 returned 200. Only an offset equal to the width returned 500.
go-dims returns an error for a crop whose clamped width or height reaches zero. See
internal/commands/crop.go.Verify
278 cases pass. The added cases are TestCropOffsetOnTheEdge, TestCropWithoutHeight, TestResizeBelowOnePixel, and TestWatermarkOnAOnePixelSource.
TestCropXOffsetOutsideImage and TestCropYOffsetOutsideImage now assert a status. Their four golden files are deleted. No golden file moved.
The status assertions run against the server on port 8001, in
test/http/test_no_error_image.c. The server on port 8000 has an error image, so a failure there returns 200 with a picture.