This is an automated email from the ASF dual-hosted git repository.

jli pushed a commit to branch fix-app-root-logos
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 3b655f9c281c49b9f6f4983883daf22aa7cb46ee
Author: Joe Li <[email protected]>
AuthorDate: Sun Mar 1 21:06:00 2026 -0800

    fix(frontend): update makeUrl docstring and pin URI scheme edge case
    
    - makeUrl JSDoc now documents the absolute/protocol-relative passthrough
      behavior introduced alongside the ensureAppRoot fix
    - Adds an explicit test for custom URI schemes (e.g. foo:bar): the RFC 3986
      scheme regex treats them as absolute and returns them unchanged, which is
      safer than prepending the app root to produce a broken path
    
    Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
---
 superset-frontend/src/utils/pathUtils.test.ts |  9 +++++++++
 superset-frontend/src/utils/pathUtils.ts      | 14 ++++++++------
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/superset-frontend/src/utils/pathUtils.test.ts 
b/superset-frontend/src/utils/pathUtils.test.ts
index 5c8aed9df0..b061d943d5 100644
--- a/superset-frontend/src/utils/pathUtils.test.ts
+++ b/superset-frontend/src/utils/pathUtils.test.ts
@@ -221,3 +221,12 @@ test('makeUrl should preserve absolute and 
protocol-relative URLs unchanged', as
     'ftp://files.example.com/data',
   );
 });
+
+test('ensureAppRoot should treat any URI scheme as absolute (passthrough)', 
async () => {
+  // The RFC 3986 scheme regex matches any `word:` prefix, including custom 
schemes.
+  // Passthrough is the safe behavior — prepending the app root would produce a
+  // broken path like /superset/foo:bar, which is never what a caller would 
want.
+  const { ensureAppRoot } = await loadPathUtils('/superset/');
+
+  expect(ensureAppRoot('foo:bar')).toBe('foo:bar');
+});
diff --git a/superset-frontend/src/utils/pathUtils.ts 
b/superset-frontend/src/utils/pathUtils.ts
index a330d81d38..185ddc113a 100644
--- a/superset-frontend/src/utils/pathUtils.ts
+++ b/superset-frontend/src/utils/pathUtils.ts
@@ -36,16 +36,18 @@ export function ensureAppRoot(path: string): string {
 }
 
 /**
- * Creates a URL with the proper application root prefix for subdirectory 
deployments.
- * Use this when constructing URLs for navigation, API calls, or file 
downloads.
+ * Creates a URL suitable for navigation, API calls, or file downloads. 
Relative
+ * paths are prefixed with the application root for subdirectory deployments.
+ * Absolute URLs (e.g. https://...) and protocol-relative URLs (e.g. 
//example.com)
+ * are returned unchanged.
  *
- * @param path - The path to convert to a full URL (e.g., '/sqllab', 
'/api/v1/chart/123')
- * @returns The path prefixed with the application root (e.g., 
'/superset/sqllab')
+ * @param path - The path or URL to resolve (e.g., '/sqllab', 
'https://example.com')
+ * @returns The resolved URL (e.g., '/superset/sqllab' or 
'https://example.com')
  *
  * @example
  * // In a subdirectory deployment at /superset
- * makeUrl('/sqllab?new=true') // returns '/superset/sqllab?new=true'
- * makeUrl('/api/v1/chart/export/123/') // returns 
'/superset/api/v1/chart/export/123/'
+ * makeUrl('/sqllab?new=true')          // returns '/superset/sqllab?new=true'
+ * makeUrl('https://external.example.com') // returns 
'https://external.example.com'
  */
 export function makeUrl(path: string): string {
   return ensureAppRoot(path);

Reply via email to