sadpandajoe commented on code in PR #39925:
URL: https://github.com/apache/superset/pull/39925#discussion_r3270386977
##########
superset/views/explore.py:
##########
@@ -33,11 +35,33 @@
@permission_name("read")
@event_logger.log_this
def root(self) -> FlaskResponse:
+ # After `Superset.route_base = ""`, both `Superset.explore` and this
+ # view register at `/explore/`; this view wins. Preserve the legacy
+ # form_data → form_data_key cache-and-redirect contract here so
+ # callers passing `?form_data=...` with a datasource still get the
+ # short cache-key URL. Form_data without a datasource (e.g. legacy
+ # `slice_url` payloads carrying only `slice_id`) cannot be cached,
+ # so `get_redirect_url` would return the same URL — falling back to
+ # SPA rendering avoids a 302 loop.
+ if request_form_data := request.args.get("form_data"):
+ try:
+ parsed_form_data = loads_request_json(request_form_data)
+ except ValueError:
+ parsed_form_data = {}
+ if parsed_form_data.get("datasource"):
+ from superset.views.core import Superset # avoid circular
import
+
+ return redirect(Superset.get_redirect_url())
Review Comment:
Refactored in 4dd4131d47 — `get_redirect_url` now passes the parsed query
params through `url_for("ExploreView.root", **params)` instead of concatenating
an encoded query string onto a `url_for` path, so the dataflow engine sees user
input reaching the redirect only via Flask's URL-building machinery (a
recognised sanitiser). The redirect target's host/path are fixed; only query
params are user-controlled.
--
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]