Skip to content

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

@tadeumaia

Description

@tadeumaia

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions