mirror of
https://github.com/apache/superset.git
synced 2026-05-29 20:29:34 +00:00
Drains the PATH_UTILS_IMPORT_ALLOWLIST to empty by routing every direct
caller of `ensureAppRoot` / `makeUrl` through `src/utils/navigationUtils`,
either via the focused helpers (`openInNewTab`, `redirect`,
`getShareableUrl`, `<AppLink>`) or via the re-exported `ensureAppRoot` /
`makeUrl` for legitimate raw-prefix needs (native fetch, navigator
.sendBeacon, image src, third-party `href` props).
Changes by category:
Bug fixes (double-prefix removed)
- src/components/Chart/DrillDetail/DrillDetailPane.tsx — drop
`ensureAppRoot` wrap from `SupersetClient.postForm` (the client adds
appRoot internally)
- src/components/Chart/chartAction.ts — same fix on `redirectSQLLab`
postForm path
Bug fix (missing prefix added)
- src/pages/RedirectWarning/index.tsx — `handleReturn` was
`window.location.href = '/'`; now uses `redirect('/')` which prefixes
the application root
Migrations to focused helpers
- src/SqlLab/components/QueryTable/index.tsx — `window.open` →
`openInNewTab`
- src/explore/components/controls/ViewQuery.tsx — `window.open` →
`openInNewTab`
- src/pages/SavedQueryList/index.tsx — `${origin}${makeUrl}` →
`getShareableUrl`; `window.open(makeUrl)` → `openInNewTab`
- src/views/CRUD/hooks.ts — `${origin}${ensureAppRoot}` →
`getShareableUrl`
Migration to navigationUtils import path (raw prefix legitimately needed)
- src/SqlLab/components/ResultSet/index.tsx
- src/components/Datasource/components/DatasourceEditor/DatasourceEditor.tsx
- src/components/FacePile/index.tsx
- src/components/StreamingExportModal/useStreamingExport.ts
- src/explore/exploreUtils/index.ts
- src/features/datasets/AddDataset/LeftPanel/index.tsx
- src/features/home/Menu.tsx
- src/features/home/RightMenu.tsx
- src/features/home/SavedQueries.tsx
- src/middleware/loggerMiddleware.ts
- src/preamble.ts
SupersetClient now wires `normalizeBackendUrls` into the response path
so backend-supplied URL fields (currently `explore_url`) are stripped of
the configured root before they reach consumers — consumers re-prefix
via the helpers, never by hand.
The static-invariant test in `navigationUtils.invariants.test.ts` is
tightened from "any mention of ensureAppRoot/makeUrl" to "any direct
import from src/utils/pathUtils". The allow-list is empty —
navigationUtils.ts is the single sanctioned re-export point.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>