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

michellet pushed a commit to branch 0.30
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git

commit a8dd1428dbbc4d86baf6c1340ac469b636929f22
Author: Grace Guo <grace....@airbnb.com>
AuthorDate: Mon Jan 7 14:28:30 2019 -0800

    [fix] url shortner for long explore url (#6449)
    
    - redirect explore url with r parameter
    - redirect to relative path
    (cherry picked from commit be1895f2dcae307f51b576bfebd49b82c5699756)
---
 superset/views/core.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/superset/views/core.py b/superset/views/core.py
index f9eb299..a15d724 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -756,8 +756,13 @@ class R(BaseSupersetView):
     @expose('/<url_id>')
     def index(self, url_id):
         url = db.session.query(models.Url).filter_by(id=url_id).first()
-        if url:
-            return redirect('/' + url.url)
+        if url and url.url:
+            explore_url = '//superset/explore/?'
+            if url.url.startswith(explore_url):
+                explore_url += f'r={url_id}'
+                return redirect(explore_url[1:])
+            else:
+                return redirect(url.url[1:])
         else:
             flash('URL to nowhere...', 'danger')
             return redirect('/')

Reply via email to