Skip to content

Commit

Permalink
Fix key error when accesing format
Browse files Browse the repository at this point in the history
  • Loading branch information
pdelboca committed Nov 21, 2023
1 parent 4aa7d25 commit f85d9cd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ckanapi/datapackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,12 @@ def resource_filename(dres):
# prefer resource names from datapackage metadata, because those have been
# made unique
name = dres['name']
ext = slugify.slugify(dres['format'])
res_format = dres.get('format')

if not res_format:
return name

ext = slugify.slugify(res_format)
if name.endswith(ext):
name = name[:-len(ext)]
return name + '.' + ext
Expand Down

0 comments on commit f85d9cd

Please sign in to comment.