You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by bk...@apache.org on 2024/01/12 01:02:20 UTC

(superset) 02/05: Pass standalone argument from redirect to the full url

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

bkyryliuk pushed a commit to branch release/3.1.0.rc4
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 6525beb6ae3c67f2b6661907a50704c81171e9b1
Author: bogdan kyryliuk <bo...@dropbox.com>
AuthorDate: Thu Jul 30 10:47:55 2020 -0700

    Pass standalone argument from redirect to the full url
---
 superset/views/redirects.py | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/superset/views/redirects.py b/superset/views/redirects.py
index 93a4339403..0871cc8ac7 100644
--- a/superset/views/redirects.py
+++ b/superset/views/redirects.py
@@ -15,7 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 import logging
-from typing import Optional
+from typing import Any, Optional
 
 from flask import flash
 from flask_appbuilder import expose
@@ -54,14 +54,19 @@ class R(BaseSupersetView):  # pylint: disable=invalid-name
         return None
 
     @event_logger.log_this
-    @expose("/<int:url_id>")
-    def index(self, url_id: int) -> FlaskResponse:
+    @expose("/<url_id>")
+    def index(self, url_id: Any) -> FlaskResponse:  # pylint: disable=no-self-use
+        standalone_prexif = ""
+        if url_id.endswith("&standalone=true"):
+            url_id = int(url_id.split("&")[0])
+            standalone_prexif = "&standalone=true"
+
         url = db.session.query(models.Url).get(url_id)
         if url and url.url:
             explore_url = self._validate_explore_url(url.url)
             if explore_url:
                 if explore_url.startswith("//explore/?"):
-                    explore_url = f"//explore/?r={url_id}"
+                    explore_url = f"//explore/?r={url_id}{standalone_prexif}"
                 return redirect(explore_url[1:])
 
             dashboard_url = self._validate_dashboard_url(url.url)