v4.0 regex for identifying Thumbor request does not work
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.
Also this regex doesn't match tif files (single f).
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
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!
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