mirror of https://github.com/apache/superset.git
fix: Persist query params appended to permalink (#27601)
This commit is contained in:
parent
8a715cc1b5
commit
5083ca0e81
|
@ -843,6 +843,8 @@ class Superset(BaseSupersetView):
|
|||
if url_params := state.get("urlParams"):
|
||||
params = parse.urlencode(url_params)
|
||||
url = f"{url}&{params}"
|
||||
if original_params := request.query_string.decode():
|
||||
url = f"{url}&{original_params}"
|
||||
if hash_ := state.get("anchor", state.get("hash")):
|
||||
url = f"{url}#{hash_}"
|
||||
return redirect(url)
|
||||
|
|
|
@ -1208,6 +1208,21 @@ class TestCore(SupersetTestCase):
|
|||
is True
|
||||
)
|
||||
|
||||
@mock.patch("superset.views.core.request")
|
||||
@mock.patch(
|
||||
"superset.commands.dashboard.permalink.get.GetDashboardPermalinkCommand.run"
|
||||
)
|
||||
def test_dashboard_permalink(self, get_dashboard_permalink_mock, request_mock):
|
||||
request_mock.query_string = b"standalone=3"
|
||||
get_dashboard_permalink_mock.return_value = {"dashboardId": 1}
|
||||
self.login()
|
||||
resp = self.client.get("superset/dashboard/p/123/")
|
||||
|
||||
expected_url = "/superset/dashboard/1?permalink_key=123&standalone=3"
|
||||
|
||||
self.assertEqual(resp.headers["Location"], expected_url)
|
||||
assert resp.status_code == 302
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
Loading…
Reference in New Issue