From 24988e97ad178c6007d5c7e4acbf009468bf2150 Mon Sep 17 00:00:00 2001 From: Nigel Babu Date: Mon, 19 Aug 2013 13:52:26 +0530 Subject: [PATCH] [#880] Use the new helper for filestore urls --- ckan/lib/dictization/model_dictize.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ckan/lib/dictization/model_dictize.py b/ckan/lib/dictization/model_dictize.py index caad1e88359..c5cbcc162d5 100644 --- a/ckan/lib/dictization/model_dictize.py +++ b/ckan/lib/dictization/model_dictize.py @@ -139,9 +139,14 @@ def resource_dictize(res, context): resource['tracking_summary'] = tracking resource['format'] = _unified_resource_format(res.format) # some urls do not have the protocol this adds http:// to these + # if they are not of url_type filestore url = resource['url'] - if not urlparse.urlsplit(url).scheme: + if (not urlparse.urlsplit(url).scheme and resource['url_type'] != + 'filestore'): resource['url'] = u'http://' + url.lstrip('/') + # for filestore urls, generate the full urls to keep API consistent + if resource['url_type'] == 'filestore': + h.filestore_url_convert(resource, qualified=True) return resource def related_dictize(rel, context):