fix(export): fix double app-root prefix in chart/drill-detail export URLs#39710
Conversation
Code Review Agent Run #7c1054Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
…URLs When Superset is deployed as a subdirectory (SUPERSET_APP_ROOT), export URLs were getting the app root applied twice. SupersetClient.postForm() adds the appRoot internally via getUrl(), so callers must not pre-apply ensureAppRoot() before passing an endpoint to any SupersetClient method. Fix: - exportChart: build URL without appRoot; apply ensureAppRoot only for the streaming path (native fetch), leave raw for postForm path - DrillDetailPane: remove ensureAppRoot() before SupersetClient.postForm() - chartAction: remove ensureAppRoot() before SupersetClient.postForm() - Add getExploreUrl includeAppRoot param to support building unprefixed legacy API URLs for the non-streaming fallback - Add regression test: postForm must receive unprefixed URL even when SUPERSET_APP_ROOT is configured Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ece1fb0 to
7cac85f
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #39710 +/- ##
==========================================
- Coverage 63.86% 63.82% -0.04%
==========================================
Files 2584 2589 +5
Lines 136678 137807 +1129
Branches 31515 31923 +408
==========================================
+ Hits 87290 87962 +672
- Misses 47872 48329 +457
Partials 1516 1516
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Code Review Agent Run #9190c0Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
SUMMARY
When Superset is deployed as a subdirectory (e.g.
SUPERSET_APP_ROOT=/analytics), export URLs were getting the app root prepended twice, resulting in broken URLs like:Root cause:
SupersetClient.postForm(endpoint)callsgetUrl({ endpoint })internally, which prependsthis.appRoot. Any caller that also calledensureAppRoot()on the URL before passing it toSupersetClientwould produce a double-prefixed URL.Fix: Build export URLs without the app root prefix and apply
ensureAppRootonly where the consumer is nativefetch(notSupersetClient):exportChart(exploreUtils/index.ts): URL is now built without appRoot. For the streaming path (onStartStreamingExport→useStreamingExport→ nativefetch),ensureAppRootis applied before passing. For theSupersetClient.postFormfallback, the raw URL is passed andSupersetClientadds the prefix.DrillDetailPane: RemovedensureAppRoot()wrapper aroundSupersetClient.postForm('/api/v1/chart/data', ...).chartAction: RemovedensureAppRoot()wrapper aroundSupersetClient.postForm('/sqllab/', ...).Also adds
includeAppRoot?: booleanparam togetExploreUrlso the legacy API path can build an unprefixed relative URL for thepostFormfallback.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — URL construction fix, no visual change.
TESTING INSTRUCTIONS
SUPERSET_APP_ROOTto a subdirectory, e.g./analytics.npm run test -- exportChart.test.tsADDITIONAL INFORMATION
🤖 Generated with Claude Code