Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
Merge pull request #18 from graceguo-supercat/gg-CherryPickFixSharedURL
Browse files Browse the repository at this point in the history
[bug] fix shortener url (apache#4560)
  • Loading branch information
Grace Guo authored Mar 7, 2018
2 parents eb95017 + 54258e5 commit 16ee3df
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions superset/views/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,17 @@ def get_form_data(self, slice_id=None):
if request_args_data:
form_data.update(json.loads(request_args_data))

url_id = request.args.get('r')
if url_id:
saved_url = db.session.query(models.Url).filter_by(id=url_id).first()
if saved_url:
url_str = parse.unquote_plus(
saved_url.url.split('?')[1][10:], encoding='utf-8', errors=None)
url_form_data = json.loads(url_str)
# allow form_date in request override saved url
url_form_data.update(form_data)
form_data = url_form_data

if request.args.get('viz_type'):
# Converting old URLs
form_data = cast_form_data(form_data)
Expand Down Expand Up @@ -1210,18 +1221,6 @@ def explore(self, datasource_type=None, datasource_id=None):
datasource_id, datasource_type = self.datasource_info(
datasource_id, datasource_type, form_data)

saved_url = None
url_id = request.args.get('r')
if url_id:
saved_url = db.session.query(models.Url).filter_by(id=url_id).first()
if saved_url:
url_str = parse.unquote_plus(
saved_url.url.split('?')[1][10:], encoding='utf-8', errors=None)
url_form_data = json.loads(url_str)
# allow form_date in request override saved url
url_form_data.update(form_data)
form_data = url_form_data

error_redirect = '/slicemodelview/list/'
datasource = ConnectorRegistry.get_datasource(
datasource_type, datasource_id, db.session)
Expand Down

0 comments on commit 16ee3df

Please sign in to comment.