-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Validation errors during resource creation lead to wrong URLs #5152
Comments
amercader
added a commit
that referenced
this issue
Jan 10, 2020
…Error Also add a custom error that we can use to show a warning in the template that users need to resubmit the file
amercader
added a commit
that referenced
this issue
Jan 10, 2020
The previously selected File is lost and it's easy to miss it, so add a little warning under the File button warning users to resubmit it
This was referenced 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
Otherwise when using errors it is shown on the error summary on top when using scheming
amercader
added a commit
that referenced
this issue
Jan 12, 2020
smotornyuk
added a commit
that referenced
this issue
Jan 16, 2020
[#5152] Fix wrong resource URL after ValidationErrors
amercader
added a commit
that referenced
this issue
Apr 3, 2020
This is an adapted commit of PR #5153
fostermh
pushed a commit
to cioos-siooc/ckan
that referenced
this issue
Sep 10, 2021
This is an adapted commit of PR ckan#5153
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This was hard to track as it doesn't happen in a standard CKAN install, as the default resource form doesn't have required fields.
If an extension implements custom validation in the resource schema, and there are errors returned in the form the File upload field will be set to the previously uploaded file name (ie a string).
When submitting, CKAN will interpret that like an external URL, and create a bogus
http://<file_name>
URL. There will be no errors returned so it's easier for users to assume that the file they first selected was successfully uploaded.To reproduce:
Modify the resource schema, eg adding the
not_empty
validator todescription
Go to the create resource page, select a file to upload, eg
libraries.csv
, leave the description empty and submitYou get redirected to the form page, with the description error, and also with "libraries.csv" set on the File field:
Submit the form. The resource is created, and has
http://libraries.csv
as URL.The safest fix I can think of is resetting the upload field if there are validation errors. This will mean that users need to select the file again, but this is preferable to create a bad URL (we can not reset the field to the actual file previously selected because of browser security limitations). We can make this obvious to users with a message.
The text was updated successfully, but these errors were encountered: