question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Thumbor paths broken if they include "-" and "100x100"

See original GitHub issue

Hi 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.

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.

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:closed
  • Created 3 years ago
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
beomseokleecommented, Aug 25, 2020

I haven’t tested whole cases, but simply, we can change the regular expression to this:

// thumbor-mapping.js
const dimPath = this.path.match(/\/((\d+x\d+)|(0x\d+))\//g);
if (dimPath) {
    const dims = dimPath[0].replace(/\//g, '').split('x');

I’ll be back when I’m done the full testing.

1reaction
Furytroncommented, Apr 20, 2020

Thanks @beomseoklee !

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found