mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-12-01 21:05:42 +09:00
An embedded dashboard remained at its loader in session preview because its script used the published `/cgi/asset/<stored-name>` URL. The generated preview had downloaded the asset, but its URL table only matched the friendly asset path, so the script request returned 404 locally. Map a stored file’s CGI URL to the generated asset path when the generated URL differs. Keep canonical paths subject to their existing ambiguity rules, and add CGI aliases without overriding canonical paths. Deduplicate aliases that share a destination and omit conflicting aliases. Resizable images keep their separate image route. Screenshot errors also keep a safe JavaScript line number when Chrome does not provide a safe generated source path, preferring a later safe filename when available. - [x] Reproduced #6723 on its reported project. Before the fix, the embedded script returned 404 in local preview; the published URL returned 200. - [x] After the fix, the script loaded and the page reached its sign-in screen with no failed requests or browser errors. The preview does not import the app’s authenticated session. - [x] Add regression tests for generated file aliases, duplicate and conflicting paths, custom asset bases, image routing, HtmlEmbed rewriting, and screenshot location ordering. - [x] Run focused suites: asset URL (9), HTML Embed (18), and targeted CLI prebuild (1 passed, 152 skipped); project-build typecheck, lint, formatting, and diff checks. - [x] Address final review findings for canonical path precedence and ambiguity; the existing HTML Embed documentation already states the expected behavior. - [x] Regenerate the affected fixture output; a second build produced no further changes. - [x] All required checks pass for the latest commit. Ref #6723
Webstudio Fixtures
Fixtures are test projects that ensure the CLI and build process work correctly across different deployment targets.
Updating Fixtures After Changes
# From repository root - updates all fixtures
pnpm fixtures
This command will:
- Link all fixtures to their respective projects
- Sync the latest data from the development environment
- Build all fixtures with the latest code
Working with Individual Fixtures
# Go to fixture folder
cd fixtures/webstudio-features
# Link to project
pnpm fixtures:link
# Sync latest data
pnpm fixtures:sync
# Build fixture
pnpm fixtures:build
# Start it
pnpm run dev
Adding Assets to Fixtures
To add a new asset (image, video, audio, etc.) to a fixture:
-
Publish to staging
- Make your changes in the builder
- Publish to the staging environment
-
Get the build ID from CI
- After publishing, check the CI logs
- Find the build ID that was created
-
Update the fixture's build ID
- Edit
fixtures/[fixture-name]/package.json - Update the
--buildIdparameter in thefixtures:syncscript
"fixtures:sync": "pnpm cli sync --buildId NEW_BUILD_ID_HERE && pnpm oxfmt ./.webstudio/" - Edit
-
Sync with the correct environment
# Go to fixture folder cd fixtures/webstudio-features # Sync from staging environment (replace with your branch) BUILDER_HOST=fix-assets.staging.webstudio.is pnpm run fixtures -
Fix the origin URL
- After syncing, edit
.webstudio/data.json - Change the origin back to:
"origin": "https://main.development.webstudio.is"- This is necessary because sync changes it to the current branch
- After syncing, edit
-
Commit the changes
git add fixtures/ git commit -m "chore: update fixtures with new assets" git push