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

Bug: regex won't match valid cloudflare image url's #127

Open
tadeumaia opened this issue Apr 1, 2024 · 0 comments
Open

Bug: regex won't match valid cloudflare image url's #127

tadeumaia opened this issue Apr 1, 2024 · 0 comments

Comments

@tadeumaia
Copy link

Hello,

Very nice library.
I'm trying to setup unpic img on my project but I'm hitting 1 problems with my url, and would like to check if it's by design or am I doing something wrong?

This is what my project uses on cloudflare images:
https://www.domain.com/cdn-cgi/imagedelivery/96E5KstIXRryMlVJjlvC4g/imagens/10382508/07aa3288-fb73-4bf7-af55-3f6cb10a6416/public

This is the regex being used to cloudflare matching that I could find on the code
/https?:\/\/(?<host>[^\/]+)\/cdn-cgi\/imagedelivery\/(?<accountHash>[^\/]+)\/(?<imageId>[^\/]+)\/*(?<transformations>[^\/]+)*$/g

host = https://www.domain.com/
static cloudflare path = /cdn-cgi/imagedelivery/
account hash = 96E5KstIXRryMlVJjlvC4g
image patch = /imagens/10382508/07aa3288-fb73-4bf7-af55-3f6cb10a6416
transformations = /public

On cloudflare side, this url works perfectly. but it looks like this regex only allows single path image, If I try to pass only a single path image to unpic it works. (ex https://www.domain.com/cdn-cgi/imagedelivery/96E5KstIXRryMlVJjlvC4g/07aa3288-fb73-4bf7-af55-3f6cb10a6416/public works)

Is this something that could be fixed on unpic side?

Thanks for your time.

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

1 participant