Skip to content

Uploads for multiple resources broken in development branch #8496

@amercader

Description

@amercader

CKAN version

master (CKAN 2.12)

Describe the bug

The first uploaded file is stored correctly and can be downloaded. All uploaded files for new resources added to the same dataset will be broken:

  File "/home/adria/dev/pyenvs/ckan-py3.9/ckan/ckan/config/middleware/../../views/resource.py", line 170, in download
    resp = flask.send_file(filepath, download_name=filename)
  File "/home/adria/.pyenv/versions/3.9.16/envs/ckan-py3.9/lib/python3.9/site-packages/flask/helpers.py", line 499, in send_file
    return werkzeug.utils.send_file(  # type: ignore[return-value]
  File "/home/adria/.pyenv/versions/3.9.16/envs/ckan-py3.9/lib/python3.9/site-packages/werkzeug/utils.py", line 428, in send_file
    stat = os.stat(path)
FileNotFoundError: [Errno 2] No such file or directory: '/home/adria/dev/pyenvs/ckan-py3.9/data/resources/06b/b87/17-35c2-4e23-b971-c7fae2831189'

Looking at the storage dir, all new files get stored in the same folder as the first one it was uplodaded

So if I upload a CSV:

ls -thor ../data/resources
total 40K
drwxrwxr-x 3 adria 4.0K Oct 29 12:23 89c    # <-- This will be the CSV

And if then I create a new resource and upload a PNG

ls -thor ../data/resources
total 40K
drwxrwxr-x 3 adria 4.0K Oct 29 12:23 89c    # <-- This will be the PNG

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions