Nanny7 commited on
Commit
f26e9e8
·
1 Parent(s): a54c76c

Use absolute iframe URL when available

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -319,7 +319,9 @@ def _build_chemiscope_embed(dataset_payload: dict, dataset_path: str | Path) ->
319
  viewer_path = dataset_file.parent / viewer_name
320
  viewer_path.write_text(combined, encoding="utf-8")
321
 
322
- iframe_src = f"/file={urllib.parse.quote(viewer_path.as_posix())}"
 
 
323
  return (
324
  "<div style='width:100%;'>"
325
  "<iframe "
 
319
  viewer_path = dataset_file.parent / viewer_name
320
  viewer_path.write_text(combined, encoding="utf-8")
321
 
322
+ view_rel_path = f"/file={urllib.parse.quote(viewer_path.as_posix())}"
323
+ space_origin = _infer_space_origin()
324
+ iframe_src = f"{space_origin}{view_rel_path}" if space_origin else view_rel_path
325
  return (
326
  "<div style='width:100%;'>"
327
  "<iframe "