-
Notifications
You must be signed in to change notification settings - Fork 49
Open
Description
Problem
When a Cloudflare Images URL already has a variant/transforms in the path, Unpic generates malformed srcset URLs.
Input URL
https://imagedelivery.net/5LGXGUnHU18h6ehN_xjpXQ/abc123/public
or with transforms:
https://imagedelivery.net/5LGXGUnHU18h6ehN_xjpXQ/abc123/w=1200,fit=scale-down
Output (broken)
https://imagedelivery.net/5LGXGUnHU18h6ehN_xjpXQ/abc123/public=undefined,w=640,h=480,fit=cover 640w
The =undefined is clearly wrong, and it's appending to the existing variant instead of replacing it.
Expected
Either:
- Replace the existing variant with the new transforms
- Or detect that transforms are already present and skip transformation
Working case
When the URL has no variant, it works correctly:
// Input
https://imagedelivery.net/5LGXGUnHU18h6ehN_xjpXQ/abc123
// Output (correct)
https://imagedelivery.net/5LGXGUnHU18h6ehN_xjpXQ/abc123/w=640,h=480,fit=cover 640w
Workaround
We're currently stripping the variant from URLs before passing to Unpic and using the base URL only.
Version
@unpic/core 1.0.3
Metadata
Metadata
Assignees
Labels
No labels