未验证 提交 be1895f2 编写于 作者: G Grace Guo 提交者: GitHub

[fix] url shortner for long explore url (#6449)

- redirect explore url with r parameter
- redirect to relative path
上级 68e9d297
......@@ -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('/')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册