Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v4.0 regex for identifying Thumbor request does not work #125

Closed
soupy1976 opened this issue Jul 24, 2019 · 4 comments
Closed

v4.0 regex for identifying Thumbor request does not work #125

soupy1976 opened this issue Jul 24, 2019 · 4 comments

Comments

@soupy1976
Copy link

The regex for identifying Thumbor requests has some problems:

const matchThumbor = new RegExp(/^(\/?)((fit-in)?|(filters:.+\(.?\))?|(unsafe)?).*(.+jpg|.+png|.+webp|.+tiff|.+jpeg)$/);

    There are a couple of issues with this regex:
    - The first part is pointless, because all of the alternatives are optional, and it then does a match on anything .* - so first part has no effect as it matches anything anyway
    - The list of image file extensions is an unreliable way to match the path. For instance, I had an issue with a jpg where the file extension was capitalised.
@kasper-sf
Copy link

Also this regex doesn't match tif files (single f).

@ganey
Copy link

ganey commented Jul 30, 2019

Personally I think this should match json, then fall back to thumbor style.
I had to change the code because the images I was using do not have any extension

@hayesry
Copy link
Member

hayesry commented Aug 4, 2019

Hey all, we're in the process of reviewing #130 to resolve this issue. Feel free to take a look at the changes made and provide feedback!

@beomseoklee
Copy link
Member

We have updated our solution, and I believe your issue has been fixed. If you still see the issue with the latest version (v4.2), please feel free to reopen the issue.

You can refer to the recent changes here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants