-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Description
unpic/src/providers/cloudflare.ts
Line 116 in eefd617
| const url = toUrl(options?.domain ? `https://${options.domain}` : "/"); |
As seen here, in the cloudflare.ts file, the generated path ends up lacking the domain in front of the
/cdn-cgi/image/ path because there's only one parameter passed to the toUrl() function. So we end up with urls that look like "/cdn-cgi/images/(modifiers)/https://(url-with-domain)" instead of the expected(?) "https://(domain)/cdn-cgi/images/(modifiers)/(filename)
Default url generation, with a custom domain:
/cdn-cgi/image/width=2560,height=1440,f=auto,fit=cover/https://images.yakitori.ca/tuyaux-rapproches-blanc-rouille-3626x5439.jpg
What it should actually look like:
https://images.yakitori.ca/cdn-cgi/image/width=1800,quality=75,format=auto/plumbing-professional-doing-his-job-6000x4000.jpg
and this also works:
https://images.yakitori.ca/cdn-cgi/image/width=2560,height=1440,f=auto,fit=cover/https://images.yakitori.ca/tuyaux-rapproches-blanc-rouille-3626x5439.jpg
I managed to make it work by changing the toUrl to actually have 2 parts
const url = toUrl(`/cdn-cgi/image/${modifiers}/${stripLeadingSlash(src.toString())}`, options?.domain ? `https://${options.domain}` : "/");
// url.pathname = `/cdn-cgi/image/${modifiers}/${stripLeadingSlash(src.toString())}`;Metadata
Metadata
Assignees
Labels
No labels