sadpandajoe commented on code in PR #37523:
URL: https://github.com/apache/superset/pull/37523#discussion_r3509827857
##########
superset/views/base.py:
##########
@@ -591,6 +591,23 @@ def get_spa_payload(extra_data: dict[str, Any] | None =
None) -> dict[str, Any]:
return payload
+def _ensure_static_assets_prefix(url_or_path: str) -> str:
+ """Add the configured static asset prefix to root-relative asset paths."""
+ static_assets_prefix = app.config.get("STATIC_ASSETS_PREFIX", "")
+
+ if not url_or_path.startswith("/") or not static_assets_prefix:
Review Comment:
Could we preserve protocol-relative URLs here too? With
`STATIC_ASSETS_PREFIX="/analytics"` and
`brandSpinnerUrl="//cdn.example.com/spinner.gif"`, this returns
`"/analytics//cdn.example.com/spinner.gif"`; before this change `spa.html`
rendered the value directly, and #39925 also treats `//` URLs as passthrough,
so this helper should return it unchanged and add a regression test next to
`test_brandspinnerurl_keeps_absolute_url`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]