chore: Reuse isAbsoluteUrl by kof · Pull Request #5587 · webstudio-is/webstudio

added 3 commits

January 27, 2026 13:12
…tion

When constructing /cgi/image/ URLs for absolute remote URLs like
https://example.com/..., the encodePathFragment function was replacing
%2F with /, creating paths with // after the protocol. Web servers
normalize // to / in URL paths, breaking the remote URL.

Now absolute URLs keep slashes fully encoded (%2F) while relative
paths continue using unencoded slashes for cleaner URLs.
- Add isAbsoluteUrl function to @webstudio-is/sdk url-pattern module
- Add tests for the new utility
- Update all consumers to use the shared utility:
  - packages/image/src/image-loaders.ts
  - apps/builder/app/canvas/interceptor.ts
  - apps/builder/app/builder/features/style-panel/sections/backgrounds/background-image.tsx
…lity

Cloudflare Image Resizing expects unencoded slashes in the URL path.
The isAbsoluteUrl utility is still available in SDK for other consumers.

@kof kof changed the title fix: Encode slashes in absolute URLs to prevent path normalization chore: Reuse isAbsoluteUrl

Jan 27, 2026

@kof kof deleted the img-loader.staging branch

January 27, 2026 14:34