Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

Canonicalize widget files in HTML exports (#10261)

Trevor Manz336f0320c183
diff --git a/marimo/_server/export/exporter.py b/marimo/_server/export/exporter.py
index a48f13afaa..f3ff2bb464 100644
--- a/marimo/_server/export/exporter.py
+++ b/marimo/_server/export/exporter.py
@@ -369,7 +369,7 @@ class Exporter:
file_url, max_inline_bytes=max_inline_bytes
)
if data_uri:
- virtual_files[file_url] = data_uri
+ virtual_files[normalized_url.removeprefix(".")] = data_uri
return virtual_files
diff --git a/tests/_server/export/test_exporter.py b/tests/_server/export/test_exporter.py
index f51f2e0672..ed74957d66 100644
--- a/tests/_server/export/test_exporter.py
+++ b/tests/_server/export/test_exporter.py
@@ -573,6 +573,7 @@ def test_export_as_html_includes_composed_widget_esm(
),
)
+ assert f'"/{widget_url.removeprefix("./")}":' in html
assert base64.b64encode(widget_code).decode("ascii") in html