Skip to content

fix: Omit raw format from direct asset URLs - #6016

Draft
kof wants to merge 2 commits into
mainfrom
agent/fix-markdown-image-origin-6014
Draft

fix: Omit raw format from direct asset URLs#6016
kof wants to merge 2 commits into
mainfrom
agent/fix-markdown-image-origin-6014

Conversation

@kof

@kof kof commented Aug 5, 2026

Copy link
Copy Markdown
Member

Summary

Generate direct project-asset URLs without ?format=raw, regardless of whether the asset is an image, video, font, document, text file, or another supported format. Runtime asset URLs remain root-relative, while optimized Image components add explicit transformation parameters only when they actually request a transformation.

Root cause

Direct URLs encoded the absence of transformation as format=raw. That mixed a no-operation decision into every asset URL and made passthrough depend on a query flag instead of the absence of requested operations.

Implementation

  • Generate direct optimized-image URLs as /cgi/image/<asset> with no query parameters.
  • Generate all other direct asset URLs as /cgi/asset/<asset> with no query parameters.
  • Change the image-loader passthrough contract from { format: "raw" } to a parameterless { src } request.
  • Remove format=raw from page social images and imported Inception image URLs.
  • Keep runtime asset URLs root-relative across origins.
  • Keep explicit resizing, quality, fit, gravity, and output-format transformations unchanged.
  • Continue accepting legacy proxied URLs containing format=raw as loader inputs.

Todo

  • Add regression expectations and demonstrate they fail against the previous URL generators.
  • Remove format=raw from direct URLs for every supported asset format.
  • Preserve root-relative runtime URLs for Markdown and asset resources.
  • Preserve explicit transformations added by Image component loaders.
  • Remove remaining direct-URL format=raw producers in social images and imported images.
  • Run SDK, image, React SDK, Builder, asset-repository, and CLI tests/typechecks.
  • Run formatting, targeted lint, and git diff --check.
  • Run the complete fixture sync/build pipeline and inspect its output; no fixture files changed.
  • Review authoritative Builder documentation. This simplifies an internal URL contract without changing a documented user workflow, so no documentation update is required.

Verification

  • pnpm --filter @webstudio-is/sdk test -- assets.test.ts
  • pnpm --filter @webstudio-is/image test -- image-optimize.test.ts image-loaders.test.ts
  • pnpm --filter @webstudio-is/builder test -- app/shared/copy-paste/asset-upload.test.tsx app/builder/features/text-file-editor/markdown-preview.test.tsx
  • pnpm --filter @webstudio-is/asset-uploader test -- asset-repository.test.ts
  • pnpm --filter webstudio test -- asset-files.test.ts prebuild.test.ts
  • SDK, image, React SDK, Builder, and CLI typechecks
  • Targeted oxlint and oxfmt --check
  • pnpm fixtures
  • git diff --check

Regression expectations were run against the previous implementations and failed because direct URLs still emitted ?format=raw; they pass with this change. Agent evaluations were not run because evaluation approval was not requested.

Dependency and deployment order

Depends on webstudio-is/webstudio-saas#654. Merge and deploy that worker change before releasing this Builder change; otherwise a parameterless image-route request would still receive the old default 256px transformation.

Closes #6014

@kof kof changed the title fix: Omit raw format from direct image URLs fix: Omit raw format from direct asset URLs Aug 5, 2026
@kof
kof temporarily deployed to development August 5, 2026 09:31 — with GitHub Actions Inactive
@kof
kof temporarily deployed to development August 5, 2026 09:32 — with GitHub Actions Inactive
@kof
kof temporarily deployed to development August 5, 2026 09:32 — with GitHub Actions Inactive
@kof
kof temporarily deployed to development August 5, 2026 09:32 — with GitHub Actions Inactive
@kof
kof temporarily deployed to development August 5, 2026 09:32 — with GitHub Actions Inactive
@kof
kof temporarily deployed to development August 5, 2026 09:32 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove transformation flags from direct project-asset URLs

1 participant