Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cosmos/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import importlib

__version__ = "1.14.1"
__version__ = "1.14.2a1"


# Mapping of public names to their module paths for lazy loading via __getattr__.
Expand Down
2 changes: 1 addition & 1 deletion cosmos/plugin/airflow3.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def dbt_docs_view(slug_alias: str = slug) -> str: # type: ignore[no-redef]
cfg_local = projects.get(slug_alias, {})
if not cfg_local.get("dir"):
return "<div>dbt Docs are not configured.</div>"
iframe_src = f"/cosmos/{slug_alias}/dbt_docs_index.html"
iframe_src = f"{API_BASE_PATH}/cosmos/{slug_alias}/dbt_docs_index.html"
safe_iframe_src = html.escape(iframe_src, quote=True)
return (
'<div style="height:100%;display:flex;flex-direction:column;">'
Expand Down
19 changes: 19 additions & 0 deletions tests/plugin/test_plugin_af3.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,25 @@ def test_manifest_and_catalog_error_500(tmp_path: Path):
assert "catalog read failed" in r.text


@skip_pre_airflow_31
def test_dbt_docs_view_iframe_src_uses_api_base_path(tmp_path: Path):
# Regression: iframe src must include the deployment path prefix (e.g. Astronomer /de3jzcwo)
# so browsers don't strip it and hit the wrong URL.
docs_dir = tmp_path / "target"
docs_dir.mkdir(parents=True)
(docs_dir / "index.html").write_text("<head></head><body>dbt</body>")

af3 = _reload_af3_module(api_base="https://host/de3jzcwo")
projects = {"core": {"dir": str(docs_dir), "index": "index.html"}}
with patch("cosmos.plugin.airflow3._load_projects_from_conf", return_value=projects):
app = af3.create_cosmos_fastapi_app()

client = TestClient(app)
r = client.get("/core/dbt_docs")
assert r.status_code == 200
assert "/de3jzcwo/cosmos/core/dbt_docs_index.html" in r.text


@skip_pre_airflow_31
def test_external_view_href_uses_api_base_path():
# Ensure base path is respected (e.g., Astronomer deployment prefix)
Expand Down
Loading