From 8210da1d2ab631760ec44053b0a949eb11f718f9 Mon Sep 17 00:00:00 2001 From: Konstantin Sivakov Date: Mon, 6 Aug 2018 10:23:43 +0200 Subject: [PATCH] Changes according revieew --- ckan/lib/dictization/model_save.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ckan/lib/dictization/model_save.py b/ckan/lib/dictization/model_save.py index d9670030fa4..454159f41df 100644 --- a/ckan/lib/dictization/model_save.py +++ b/ckan/lib/dictization/model_save.py @@ -33,9 +33,8 @@ def resource_dict_save(res_dict, context): fields = [field.name for field in table.c] # Strip the full url for resources of type 'upload' - if res_dict.get('url_type') == u'upload': - url = res_dict.get('url') - res_dict[u'url'] = url[url.rfind(u"/")+1:] + if res_dict.get('url') and res_dict.get('url_type') == u'upload': + res_dict['url'] = res_dict['url'].rsplit('/')[-1] # Resource extras not submitted will be removed from the existing extras # dict