Thanks to visit codestin.com
Credit goes to github.com

Skip to content

resource_patch does not update file size #7075

@bzar

Description

@bzar

CKAN version
2.9.5, probably others

Describe the bug
Updating an uploaded resource file through API does not update the resource's size field

Steps to reproduce
Steps to reproduce the behavior:

  1. Create a dataset and a file upload resource
  2. Observe the resource's size field value
  3. Change the file through the UI
  4. Observe the resource's size field value changes as it should
  5. Use the action API to upload a new file with resource_patch (or resource_update, I assume)
  6. Observe the resource's size field value stays the same

Expected behavior
The file size should reflect the uploaded file regardless of the method used to upload it

Additional details
I assume this is because the resource already has a size field when resource_update calls package_update, which assumes it is already set to the correct value. In resource_create the size is set, but resource_update just keeps the same value as before. Thus the new file size is not set.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions