Oleg Isonen bf288341a3 fix: Resolve asset URLs in generated previews (#6724)
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
2026-11-19 18:24:48 +01:00
2026-02-05 10:25:17 +01:00
2026-03-20 21:09:47 +01:00
2023-09-06 21:43:29 +03:00

builder-screenshot

Webstudio is an Open Source Visual Development Platform for developers, designers, and cross-functional teams. You own the data, components, and infrastructure. You can use the hosted version or roll out your own.


Learning Resources

Social Media

License

  • Webstudio core (all functionality in this repository) is free/open-source under AGPL-3.0-or-later.
  • sdk-components-animation package (optional) is proprietary. You must accept the Webstudio, Inc. EULA located in sdk-components-animation/LICENSE before using it.
Languages
TypeScript 97.9%
PLpgSQL 1.5%
CSS 0.3%
Shell 0.2%
JavaScript 0.1%