Thumbor paths broken if they include "-" and "100x100"
See original GitHub issueHi All,
Hope someone can help me with this one. I’ve got v4.2 deployed and we have stumbled onto an odd issue. I’ve looked at the open and closed tickets and could only see 163 which might be related but is not the same.
When an S3 key has a hypen “-” and is then followed by two numbers that are separated by (lowercase) “x” either in the path or the filename the image is not returned to you when you go to the cloudfront URL.
Some examples of broken URLs that only return an empty object: {}
with a 200 response.
- https://test.cloudfront.net/test/test-100x100.jpg
- https://test.cloudfront.net/test/test-100x100x.jpg
- https://test.cloudfront.net/test/test--100x100.jpg
To narrow down the scope of the problem, I tried the following URLs with altered but similar filenames and they all work correctly. Images are returned.
- https://test.cloudfront.net/test/test-100y100.jpg
- https://test.cloudfront.net/test/test100-100.jpg
- https://test.cloudfront.net/test/test100x100.jpg
- https://test.cloudfront.net/test/test100y100.jpg
- https://test.cloudfront.net/test/-test100x100.jpg
- https://test.cloudfront.net/test/test100100-.jpg
- https://test.cloudfront.net/test/test100x100-.jpg
- https://test.cloudfront.net/test/test-asd100x100x.jpg
- https://test.cloudfront.net/test/test-100X100.jpg (Note the uppercase x)
The same is happening for paths in the S3 key, but you get a different response (404) from the browser. For example a broken URL with the values in the path:
This time you get the following returned:
status 404 code "NoSuchKey" message "The specified key does not exist."
I think the issue is being caused by the confusion with the “fit-in” filter: /fit-in/800x1000/ but that is just a guess.
For the path issue, it might be related to the code in image-request.js.
A code test using that function shows that the URL paths are broken: https://jsfiddle.net/Furytron/bqjf07zu/2/ when they include those characters, in that order. But this code does not break for the filename. So there may be two issues occurring here.
Any help would be appreciated on this.
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (3 by maintainers)
Top GitHub Comments
I haven’t tested whole cases, but simply, we can change the regular expression to this:
I’ll be back when I’m done the full testing.
Thanks @beomseoklee !