Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource URL gets changed to ___ #5031

Closed
davidread opened this issue Oct 18, 2019 · 1 comment · Fixed by #5032
Closed

Resource URL gets changed to ___ #5031

davidread opened this issue Oct 18, 2019 · 1 comment · Fixed by #5032
Assignees

Comments

@davidread
Copy link
Contributor

CKAN Version if known (or site URL)

latest master

The probem

When I create or edit a resource using the web form, whatever I set the resource.url to be, it gets saved as something like this: http://myckansite.com/dataset/713c8c32-cbd8-46ce-90fb-86de1f0811d2/resource/59c0e90c-11e2-4d7f-af43-e098660745dc/download/___ (!)
It shouldn't change it. And the URL it sets it to gives a 404.

@davidread
Copy link
Contributor Author

I bisected to find the cause: ea4ceb4

Date:   Wed Aug 21 20:43:31 2019 +0100
    Upgrade werkzeug

davidread pushed a commit that referenced this issue Oct 18, 2019
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.
amercader added a commit that referenced this issue Jan 10, 2020
amercader added a commit that referenced this issue Jan 10, 2020
amercader added a commit that referenced this issue Jan 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants