unpic icon indicating copy to clipboard operation
unpic copied to clipboard

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

Open tadeumaia opened this issue 1 year ago • 0 comments

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.

tadeumaia avatar Apr 01 '24 12:04 tadeumaia