Skip to content

Commit

Permalink
Revert last commit, add the striping logic in the resource dictize
Browse files Browse the repository at this point in the history
  • Loading branch information
tino097 committed Nov 28, 2018
1 parent 90a8a53 commit 7033203
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ckan/lib/dictization/model_dictize.py
Expand Up @@ -108,14 +108,15 @@ def resource_dictize(res, context):
## for_edit is only called at the times when the dataset is to be edited
## in the frontend. Without for_edit the whole qualified url is returned.
if resource.get('url_type') == 'upload' and not context.get('for_edit'):
url = url.rsplit('/')[-1]
cleaned_name = munge.munge_filename(url)
resource['url'] = h.url_for('resource.download',
id=resource['package_id'],
resource_id=res.id,
filename=cleaned_name,
qualified=True)
elif resource['url'] and not urlparse.urlsplit(url).scheme:
res_dict['url'] = res_dict['url'].rsplit('/')[-1]
elif resource['url'] and not urlparse.urlsplit(url).scheme and not context.get('for_edit'):
resource['url'] = u'http://' + url.lstrip('/')
return resource


Expand Down

0 comments on commit 7033203

Please sign in to comment.