You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2026/08/10 20:31:30 UTC
(superset) branch fix/followup-41347-follow-up-from-41347-fix-theming-deep-me created (now a06a0b58a36)
This is an automated email from the ASF dual-hosted git repository.
rusackas pushed a change to branch fix/followup-41347-follow-up-from-41347-fix-theming-deep-me
in repository https://gitbox.apache.org/repos/asf/superset.git
at a06a0b58a36 fix(theming): guard ensureStaticPrefix against null/undefined input
This branch includes the following new commits:
new a06a0b58a36 fix(theming): guard ensureStaticPrefix against null/undefined input
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(superset) 01/01: fix(theming): guard ensureStaticPrefix against null/undefined input
Posted by ru...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rusackas pushed a commit to branch fix/followup-41347-follow-up-from-41347-fix-theming-deep-me
in repository https://gitbox.apache.org/repos/asf/superset.git
commit a06a0b58a36845ed58c3d64fa8bc11af99d76fa9
Author: rusackas <ev...@rusackas.com>
AuthorDate: Mon Aug 10 13:30:54 2026 -0700
fix(theming): guard ensureStaticPrefix against null/undefined input
ensureStaticPrefix() called .startsWith() unconditionally, so callers
passing an unset theme.brandLogoUrl or brand.icon (e.g. a partial theme
reaching the frontend from a DB-stored theme rather than
superset_config.py) reproduce the white-screen crash fixed for
config-based overrides in #41347.
Co-Authored-By: Claude Sonnet 5 <no...@anthropic.com>
---
superset-frontend/src/utils/assetUrl.test.ts | 10 ++++++++++
superset-frontend/src/utils/assetUrl.ts | 10 +++++++++-
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/superset-frontend/src/utils/assetUrl.test.ts b/superset-frontend/src/utils/assetUrl.test.ts
index 3d8307f6b3b..9c952a40f77 100644
--- a/superset-frontend/src/utils/assetUrl.test.ts
+++ b/superset-frontend/src/utils/assetUrl.test.ts
@@ -84,4 +84,14 @@ describe('ensureStaticPrefix should be idempotent', () => {
staticAssetsPrefixMock.mockReturnValue('');
expect(ensureStaticPrefix('/static/x.png')).toBe('/static/x.png');
});
+
+ test('returns undefined instead of throwing when passed undefined', () => {
+ staticAssetsPrefixMock.mockReturnValue('/superset');
+ expect(ensureStaticPrefix(undefined)).toBeUndefined();
+ });
+
+ test('returns undefined instead of throwing when passed null', () => {
+ staticAssetsPrefixMock.mockReturnValue('/superset');
+ expect(ensureStaticPrefix(null)).toBeUndefined();
+ });
});
diff --git a/superset-frontend/src/utils/assetUrl.ts b/superset-frontend/src/utils/assetUrl.ts
index 72a07eff5bd..abe886f6bdd 100644
--- a/superset-frontend/src/utils/assetUrl.ts
+++ b/superset-frontend/src/utils/assetUrl.ts
@@ -35,9 +35,17 @@ export function assetUrl(path: string): string {
* segment boundary is returned unchanged, mirroring the dedupe pattern used by
* `ensureAppRoot` in pathUtils.ts and `SupersetClient.getUrl`.
*
+ * If `url_or_path` is null or undefined, `undefined` is returned so callers
+ * (e.g. a partial theme reaching the frontend from a source other than
+ * `superset_config.py`, such as a DB-stored theme created via the API) don't
+ * crash on the unconditional `.startsWith()` call below.
+ *
* @param url_or_path A url or relative path to a resource
*/
-export function ensureStaticPrefix(url_or_path: string): string {
+export function ensureStaticPrefix(
+ url_or_path: string | null | undefined,
+): string | undefined {
+ if (url_or_path == null) return undefined;
if (!url_or_path.startsWith('/')) return url_or_path;
const prefix = staticAssetsPrefix();
if (