Skip to content

Commit

Permalink
Merge pull request #59 from qld-gov-au/QOLSVC-3224-missing-datastore-…
Browse files Browse the repository at this point in the history
…link

[QOLSVC-3224] handle any falsy url_type the same way as empty string
  • Loading branch information
ThrawnCA authored Oct 11, 2023
2 parents 3854f72 + d40e245 commit 46441ed
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions ckanext/xloader/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@ def is_resource_supported_by_xloader(res_dict, check_access=True):
user_has_access = toolkit.h.check_access('package_update', {'id': res_dict.get('package_id')})
else:
user_has_access = True
try:
is_supported_url_type = res_dict.get('url_type') not in toolkit.h.datastore_rw_resource_url_types()
except AttributeError:
is_supported_url_type = (res_dict.get('url_type') == 'upload' or res_dict.get('url_type') == '')
url_type = res_dict.get('url_type')
if url_type:
try:
is_supported_url_type = url_type not in toolkit.h.datastore_rw_resource_url_types()
except AttributeError:
is_supported_url_type = (url_type == 'upload')
else:
is_supported_url_type = True
return (is_supported_format or is_datastore_active) and user_has_access and is_supported_url_type

0 comments on commit 46441ed

Please sign in to comment.