fix: Omit raw format from direct asset URLs - #6016
Draft
kof wants to merge 2 commits into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
/cgi/image/<asset>with no query parameters./cgi/asset/<asset>with no query parameters.{ format: "raw" }to a parameterless{ src }request.format=rawfrom page social images and imported Inception image URLs.format=rawas loader inputs.Todo
format=rawfrom direct URLs for every supported asset format.format=rawproducers in social images and imported images.git diff --check.Verification
pnpm --filter @webstudio-is/sdk test -- assets.test.tspnpm --filter @webstudio-is/image test -- image-optimize.test.ts image-loaders.test.tspnpm --filter @webstudio-is/builder test -- app/shared/copy-paste/asset-upload.test.tsx app/builder/features/text-file-editor/markdown-preview.test.tsxpnpm --filter @webstudio-is/asset-uploader test -- asset-repository.test.tspnpm --filter webstudio test -- asset-files.test.ts prebuild.test.tsoxlintandoxfmt --checkpnpm fixturesgit diff --checkRegression 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