OCHA-DAP / hdx-ckan

A repo for HDX's configurations and extensions to CKAN
Other
75 stars 24 forks source link

Dataset Create: change behavior of name field with uploaded file to avoid breaking previews #3105

Closed cjhendrix closed 9 years ago

cjhendrix commented 9 years ago

Dev team may already be looking at this, but we need to consider how the name field behaves in 2.3. Before, once the file was uploaded, the file name would be used for the resource name. Now, this isn't happening (because the actual upload doesn't happen until the form is submitted).

For consistency most existing resources, I'd suggest we capture the file name and populate the resource name field when the file is selected. Tagging @amcguire62 @yumiendo for opinions/approval.

yumiendo commented 9 years ago

@cjhendrix Im happy with the solution suggested !

cjhendrix commented 9 years ago

Until this is fixed we may want to make the resource format a required field, since it is not being generated automatically from the file name.

alexandru-m-g commented 9 years ago

@cjhendrix the process will be:

  1. After the user chooses a file, the file name is being copied in the name field
  2. The format can be empty and the server will try to guess the format based on the file extension. If it cannot figure out a format ( because the filename has no extension or because the url is something like http:// yahoo.com ) then the user will be asked to provide one. Check screenshot 1

Caveat: The name of the resource might not be exactly the same as the file that the user would download. Currently CKAN removes characters like '-', '_' and others from the filename stored in db.

cjhendrix commented 9 years ago

I like the approach. Pinging @yumiendo in case there are design changes to make.

CKAN renaming the files is a bit problematic. OCHA has been pushing a standard file naming convention (primarily for the COD/FODs) for years and this will break that. I think we can live with it for now. But how deep into ckan core would we have to dig to change that. And why did they do that? Seems unecessary. Just to make the URLs nicer?