[ckan-dev] CkanClient file upload

Steven Matchett gosefroba22 at gmail.com
Wed Jan 29 19:36:16 UTC 2014


I have implemented a bulk upload using the ckanclient. But have ran into a
strange issue with file names.  I have had no problems with any files
except when they contain a '#' character.  When the character is the first
character of the file name I get this stack trace.

Module ckanext.reviewer.controller:*183* in bulk_upload
<http://localhost:5000/dataset/new_resource/test111#>
 view <http://localhost:5000/dataset/new_resource/test111#>
>>   <http://localhost:5000/dataset/new_resource/test111#>data_url = ckan.
upload_file(file_path)
Module ckanclient:*663* in upload_file
<http://localhost:5000/dataset/new_resource/test111#>
 view <http://localhost:5000/dataset/new_resource/test111#>
>>   <http://localhost:5000/dataset/new_resource/test111#>auth_dict = self.
storage_auth_get('/form/'+file_key, {})
Module ckanclient:*530* in storage_auth_get
<http://localhost:5000/dataset/new_resource/test111#>
 view <http://localhost:5000/dataset/new_resource/test111#>
>>   <http://localhost:5000/dataset/new_resource/test111#>self.open_url(url,
 payload, headers=headers, method="POST")
Module ckanclient:*233* in open_url
<http://localhost:5000/dataset/new_resource/test111#>
 view <http://localhost:5000/dataset/new_resource/test111#>
>>   <http://localhost:5000/dataset/new_resource/test111#>raise CkanApiError
(self.last_message)

CkanApiError: Got redirected to another URL, which does not work with
POSTS. Redirection:
http://localhost:5000/api/storage/auth/form/2014-01-29T143204/#SaveShenmue-January-2014.png->
http://localhost:5000/api/storage/auth/form/2014-01-29T143204

And the other error I get is that the file preview becomes broken if a '#'
symbol is anywhere in the file name.  I mean the easy solution would be to
strip out any '#', but I would hope to leave that as a last resort

Thank you,,
Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20140129/a18f1041/attachment-0002.html>


More information about the ckan-dev mailing list