[ckan-dev] Handling of text based files with unknown extensions

Aaron McGlinchy McGlinchyA at landcareresearch.co.nz
Fri Jun 27 00:11:24 UTC 2014


Further to this, there are a heap of extensions used with text file (e.g. http://www.file-extensions.org/filetype/extension/name/text-files and i can think of more such as python or R scripts that may be associated with a dataset), so a solution that doesn't require adding numerous extensions would be good (acknowledging that for extensions no specified preview won't work)

-----Original Message-----
From: Aaron McGlinchy
Sent: Friday, 27 June 2014 11:24 a.m.
To: 'ckan-dev at lists.okfn.org'
Subject: Handling of text based files with unknown extensions

Hi, I have encountered an issue whereby a user uploaded a nexus file (http://en.wikipedia.org/wiki/Nexus_file) which is in fact a text file with the extension .nex (or sometimes .nxs).  This unknown file extension caused CKAN to spit the dummy, returning an internal server error.

In testing further I found that any txt file that is uploaded with an extension that CKAN does not recognise out of the box (e.g. as per http://docs.ckan.org/en/ckan-2.2/data-viewer.html#text-preview) causes this error.  In normal CKAn behaviour an unrecognised file format triggers a save dialog box if clicked on, but for these files which are underlying txt format but varying (undefined) extension they cause an error.

I uploaded an example to the CKAN demo site http://demo.ckan.org/dataset/aarontests  so you can see what happens.

I know that we can add extra extensions to ckan.preview.loadable to ensure the nex/nxs files get handled in future, but is there a way for as yet unknown extensions that people may use/upload with text files to be treated as per any other unknown format so as to not trigger the server error?

Thanks
Aaron

________________________________

Please consider the environment before printing this email
Warning: This electronic message together with any attachments is confidential. If you receive it in error: (i) you must not read, use, disclose, copy or retain it; (ii) please contact the sender immediately by reply email and then delete the emails.
The views expressed in this email may not be those of Landcare Research New Zealand Limited. http://www.landcareresearch.co.nz



More information about the ckan-dev mailing list