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

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


The following commit(s) were added to refs/heads/master by this push:
     new be1895f  [fix] url shortner for long explore url (#6449)
be1895f is described below

commit be1895f2dcae307f51b576bfebd49b82c5699756
Author: Grace Guo <[email protected]>
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
---
 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 ded935c..99cd685 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -761,8 +761,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