diff --git a/ckanext/harvest_basket/harvesters/ods_harvester.py b/ckanext/harvest_basket/harvesters/ods_harvester.py index ce4226c..5f03245 100644 --- a/ckanext/harvest_basket/harvesters/ods_harvester.py +++ b/ckanext/harvest_basket/harvesters/ods_harvester.py @@ -151,6 +151,9 @@ def _fetch_resources(self, source_url, resource_urls, pkg_data): "name" ] = f"{pkg_data.get('title', tk._('Unnamed resource'))} ({res['rel']})" + # Try to create unique ID that won't be changed over time + resource['id'] = self._generate_unique_id(pkg_data['id'] + resource["format"], resource["url"]) + resources.append(resource) # attachments are an additional resources that we can fetch @@ -168,6 +171,9 @@ def _fetch_resources(self, source_url, resource_urls, pkg_data): resource["format"] = self._guess_attachment_format(att) resource["name"] = att.get("title", "") + # Try to create unique ID that won't be changed over time + resource['id'] = self._generate_unique_id(pkg_data['id'] + resource["format"], resource["url"]) + resources.append(resource) return resources