[ckan-changes] [ckan/ckan] e9adf7: Fix resource.url being saved as "___"
David Read
noreply at github.com
Fri Oct 18 18:13:10 UTC 2019
Branch: refs/heads/5031-fix-res-url-after-werkzeug-upgrade
Home: https://github.com/ckan/ckan
Commit: e9adf793e5eb3989e23b9c152d5898bb1adb015d
https://github.com/ckan/ckan/commit/e9adf793e5eb3989e23b9c152d5898bb1adb015d
Author: David Read <david.read at hackneyworkshop.com>
Date: 2019-10-18 (Fri, 18 Oct 2019)
Changed paths:
M ckan/lib/uploader.py
M ckan/tests/controllers/test_package.py
A ckan/tests/lib/test_uploader.py
Log Message:
-----------
Fix resource.url being saved as "___"
Fixes #5031
werkzeug upgrade 0.14 to 0.15 means that when you submit the resource form with a resource url (not an upload), and the uploader is enabled, then the 'upload' parameter value changes from being u'' to: FileStorage(filename=u''). This half-confused ResourceUpload into thinking that it should upload something and it stored the url as '___' (!). This is fixed by essentially testing bool(resource['upload']) because bool(FileStorage(filename=u'')) == False.
I was unable to test this using webtest - it didn't submit the form like my real browser does. So I just add a test for ResourceUpload that shows the issue and prevents it regressing in future.
More information about the ckan-changes
mailing list