-
Notifications
You must be signed in to change notification settings - Fork 16
Uploading files with non ASCII characters fails #72
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
Comments
I have looked further in to this and opened an issue in frontend |
Your UnicodeDecodeError fix looks good. I've updated it slightly and added some tests:
Let me know what you think. Regarding the OAuth failure, I'm seeing the same problem too. |
Great, this fixes the issue. |
Good to hear - thanks for your help. |
Thanks @sneakypete81 On Saturday, February 15, 2014, sneakypete81 [email protected]
-- Snet form my mobl phoone |
I tried to upload a file using the command line tool:
But if the filename contains non ascii characters it fails with the following error message:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 10: ordinal not in range(128)
Non ascii characters in the path is no problem:
I edited main.py line 126:
This solves the UnicodeDecodeError, but then the authention fails:
Traceback (most recent call last):
File "/usr/local/bin/trovebox", line 9, in
load_entry_point('trovebox==0.6.1', 'console_scripts', 'trovebox')()
File "/Library/Python/2.7/site-packages/trovebox/main.py", line 93, in main
files=files, **params)
File "/Library/Python/2.7/site-packages/trovebox/http.py", line 180, in post
(response.status_code, response.reason))
trovebox.errors.TroveboxError: HTTP Error 401: Unauthorized
if i check the apache error log, this is what i see when the authentication fails:
[Mon Dec 09 19:30:40.403222 2013] [:error] [pid 4995] [client 192.168.5.106:57220] {severity:warn, description:"oauth_problem=signature_invalid&debug_sbs=POST&http%3A%2F%2Fphoto.majsajt.com%2Fphoto%2Fupload.json&oauth_consumer_key%3F73048bee39a55e5db2a4a97fe421f5%26oauth_nonce%3D2567566948544325531386613844%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1386613844%26oauth_token%3D4f8f8d5a960af9e64fc2529075ffac%26oauth_version%3D1.0%26photo%3D%25FF%25D8%25FF%25E1Q%25CCExif%2500%2500II%252A%2500%2508%2500%2500%2500%250A%2500%250F%2501%2502%2500%2506%2500%2500%2500%2586%2500%2500%2500%2510%2501%2502%2500%250E%2500%2500%2500%258C%2500%2500%2500%2512%2501%2503%2500%2501%2500%2500%2500%2501%2500%2500%2500%251A%2501%2505%2500%2501%2500%2500%2500%25AC%2500%2500%2500%251B%2501%2505%2500%2501%2500%2500%2500%25B4%2500%2500%2500%2528%2501%2503%2500%2501%2500%2500%2500%2502%2500%2500%25002%2501%2502%2500%2514%2500%2500%2500%25BC%2500%2500%2500%2513%2502%2503%2500%2501%2500%2500%2500%2502%2500%2500%2500i%2587%2504%2500%2501%2500%2500%2500%25D0%2500%2500%2500%2525%2588%2504%2500%2501%2500%2500%2500%25DE%2521%2500%2500%25E0%2528%2500%2500Canon%2500Canon%2520EOS%252040D%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500H%2500%2500%2500%2501%2500%2500%2500H%2500%2500%2500%2501%2500%2500%25002008%253A05%253A24%252014%253A15%253A01%2500%251F%2500%259A%2582%2505%2500%2501%2500%2500%2500J%2502%2500%2500%259D%2582%2505%2500%2501%2500%2500%2500R%2502%2500%2500%2522%2588%2503%2500%2501%2500%2500%2500%2502%2500%2500%2500%2527%2588%2503%2500%2501%2500%2500%2500%2590%2501%2500%2500%2500%2590%2507%2500%2504%2500%2500%25000221%2503%2590%2502%2500%2514%2500%2500%2500Z%2502%2500%2500%2504%2590%2502%2500%2514%2500%2500%2500n%2502%2500%2500%2501%2591%2507%2500%2504%2500%2500%2500%2501%2502%2503%2500%2501%2592%250A%2500%2501%2500%2500%2500%2582%2502%2500%2500%2502%2592%2505%2500%2501%2500%2500%2500%258A%2502%2500%2500%2504%2592%250A%2500%2501%2500%2500%2500%2592%2502%2500%2500%2507%2592%2503%2500%2501%2500%2500%2500%2505%2500%2500%2500%2509%2592%2503%2500%2501%2500%2500%2500%2510%2500%2500%2500%250A%2592%2505%2500%2501%2500%2500%2500%259A%2502%2500%2500%257C%2592%2507%2500%2506%251E%2500%2500%25A2%2502%2500%2500%2586%2592%2507%2500%2508%2501%2500%2500%25A8%2520%2500%2500%2590%2592%2502%2500%2503%2500%2500%250000%2500%2500%2591%2592%2502%2500%2503%2500%2500%250000%2500%2500%2592%2592%2502%2500%2503%2500%2500%250000%2500%2500%2500%25A0%2507%2500%2504%2500%2500%25000100%2501%25A0%2503%2500%2501%2500%2500%2500%2501%2500%2500%2500%2502%25A0%2503%2500%2501%2500%2500%25000%250F%2500%2500%2503%25A0%2503%2500%2501%2500%2500%2500%2520%250A%2500%2500%2505%25A0%2504%2500%2501%2500%2500%2500%25B0%2521%2500%2500%250E%25A2%2505%2500%2501%2500%2500%2500%25CE%2521%2500%2500%250F%25A2%2505%2500%2501%2500%2500%2500%25D6%2521%2500%2500%2510%25A2%2503%2500%2501%2500%2500%2500%2502%2500%2500%2500%2501%25A4%2503%2500%2501%2500%2500%2500%2500%2500%2500%2500%2502%25A4%2503%2500%2501%2500%2500%2500%2500%2500%2500%2500%2503%25A4%2503%2500%2501%2500%2500%2500%2500%2500%2500%2500%2506%25A4%2503%2500%2501%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2501%2500%2500%2500%25FA%2500%2500%2500G%2500%2500%2500%250A%2500%2500%25002008%253A05%253A24%252014%253A15%253A01%25002008%253A05%253A24%252014%253A15%253A01%2500%2500%2500%2508%2500%2500%2500%2501%2500%2500%25A0%2505%2500%2500%2500%2501%2500%2500%2500%2500%2500%2501%2500%2500%2500%25C2%2500%2500%2500%2501%2500%2500%2500%2521%2500%2501%2500%2503%2500%252F%2500%2500%25004%2504%2500%2500%2502%2500%2503%2500%2504%2500%2500%2500%2592%2504%2500%2500%2503%2500%2503%2500%2504%2500%2500%2500%259A%2504%2500%2500%2504%2500%2503%2500%2522%2500%2500%2500%25A2%2504%2500%2500%2506%2500%2502%2500%250E%2500%2500%2500%25E6%2504%2500%2500%2507%2500%2502%2500%2518%2500%2500%2500%2506%2505%2500%2500%2509%2500%2502%2500%2520%2500%2500%2500%251E%2505%2500%2500%250C%2500%2504%2500%2501%2500%2500%2500O%2588%25FD%2584%250D%2500%2507%2500%2500%250C%2500%2500%253E%2505%2500%2500%2510%2500%2504%2500%2501%2500%2500%2500%2590%2501%2500%2580%2513%2500%2503%2500%2504%2500%2500%2500%253E%2511%2500%2500%2515%2500%2504%2500%2501%2500%2500%2500%2500%2500%2500%25A0%2519%2500%2503%2500%2501%2500%2500%2500%2501%2500%2500%2500%2526%2500%2503%25000%2500%2500%2500F%2511%2500%2500%2583%2500%2504%2500%2501%2500%2500%2500%2500%2500%2500%2500%2593%2500%2503%2500%2518%2500%2500%2500%25A6%2513%2500%2500%2595%2500%2502%2500%2540%2500%2500%2500%25D6%2513%2500%2500%2596%2500%2502%2500%2510%2500%2500%2500%2516%2514%2500%2500%2597%2500%2507%2500%2500%2504%2500%2500%2526%2514%2500%2500%2598%2500%2503%2500%2504%2500%2500%2500%2526%2518%2500%2500%2599%2500%2504%2500Y%2500%2500%2500.%2518%2500%2500%259A%2500%2504%2500%2505%2500%2500%2500%2592%2519%2500%2500%25A0%2500%2503%2500%250E%2500%2500%2500%25A6%2519%2500%2500%25AA%2500%2503%2500%2506%2500%2500%2500%25C2%2519%2500%2500%25B4%2500%2503%2500%2501%2500%2500%2500%2501%2500%2500%2500%25D0%2500%2504%2500%2501%2500%2500%2500%2500%2500%2500%2500%25E0%2500%2503%2500%2511%2500%2500%2500%25CE%2519%2500%2500%2501%2540%2503%2500%25B4%2502%2500%2500%25F0%2519%2500%2500%2508%2540%2503%2500%2503%2500%2500%2500X%251F%2500%2500%2509%2540%2503%2500%2503%2500%2500%2500%255E%251F%2500%2500%2510%2540%2502%2500%2520%2500%2500%2500d%251F%2500%2500%2511%2540%2507%2500%25FC%2500%2500%2500%2584%251F%2500%2500%2512%2540%2502%2500%2520%2500%2500%2500%2580%2520%2500%2500%2500%2500%2500%2500%255E%2500%2502%2500%2500%2500%2503%2500%2500%2500%2500%2500%2500%2500%2502%2500%2500%2500%2501%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%25FF%257F%25FF%257F%2503%2500%2502%2500%2500%2500%2500%2500%25FF%25FF1%2500%25FA%25007%2500%2501%2500%25A0%2500%2540%2501%2500%2500%2500%2500%2500%2500%2500%2500%25FF%25FF%25FF%25FF%25FF%25FF%2500%2500%2500%2500%2500%2500%2500%2500%25FF%25FF%25FF%25FF%2500%2500%2500%2500%25FF%257F%25FF%25FF%25FF%25FF%25FF%25FF%2500%2500%25C2%2500a%25B0%2510%251C%2500%2500%2500%2500%2500%2500%2500%2500D%2500%2500%2500%25E0%2500%25D8%2500%25B4%2500%2500%2501%2500%2500%2500%2500%2503%2500%2500%2500%2508%2500%2508%2500%2599%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2501%2500%2500%2500%2500%2500%25B4%2500%2504%2501%258E%2500%2500%2500%2500%2500%25F8%2500%25FF%25FF%25FF%25FF%25FF%25FF%25FF%25FF%2500%2500%2500%2500%2500%2500Canon%2520EOS%252040D%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500Firmware%2520Version%25201.1.1%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%25AA%25AAy5x5X%2500%258E%258E%2500%2503%2500%2500%2500%2500%2500%2500%2501%2500%2500%2506%2500%2500%2599%25BA%255Bc%2500%2500%25C2%2500%2502%2500%2500%2500%2500%2501%25BB%25BB%2501%2501%2500%2500%2500%2500%2502%2501%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2504%25E3%2504-%250C%250C%2509%25F9%2511j%2515%2588%251C%2595%2523F%2527%2524%25CC%25CC%2509%2500%2500%2500%2500%2500%2500%2500%2503%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%25FF%2501%2500%2500%2500%2500%2500%2500P%2514%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2501%2500%2500%2500%2501%2500%2500%2500%2501%2500%2500%2500%2503%2500%2500%2500%2503%2500%2500%2500%2503%2500%2500%2500%2501%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2581%2500%2500%2500%2501%2500%2500%2500%2507%2500%2500%2500%2500%2500%2500%2500%2503%2500%2500%2500%2507%2500%2500%2500%2500%2500%2500%2500%2508%2500%2500%2500%2500%2500%2500%2500%2500%25FF%25FB%25FF%2500%2500%2500%2500%2500%2500%2500%2500%25010X%25001%25007%2500%25FA%2591u%25BA%251F%2500%2500%2500%2500%2500%2500%2500%2501%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%25001.1.1%25006C%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500%2500d%2500%2500%2500d%2500%2500%2500d%2500%2500%2500%2524%2509%2500%2500%2500%2500%2500%2500%2500%2500%250
Full error message:
$ trovebox -p -X POST -e /photo/upload.json -F 'photo=@/Users/me/Dropbox/Images/Älgkalv/ÄLGKALV.jpg'
Traceback (most recent call last):
File "/usr/local/bin/trovebox", line 9, in
load_entry_point('trovebox==0.6.1', 'console_scripts', 'trovebox')()
File "/Library/Python/2.7/site-packages/trovebox/main.py", line 93, in main
files=files, *_params)
File "/Library/Python/2.7/site-packages/trovebox/http.py", line 152, in post
files=files, auth=auth)
File "/Library/Python/2.7/site-packages/requests/sessions.py", line 403, in post
return self.request('POST', url, data=data, *_kwargs)
File "/Library/Python/2.7/site-packages/requests/sessions.py", line 324, in request
prep = self.prepare_request(req)
File "/Library/Python/2.7/site-packages/requests/sessions.py", line 265, in prepare_request
hooks=merge_setting(request.hooks, self.hooks),
File "/Library/Python/2.7/site-packages/requests/models.py", line 286, in prepare
self.prepare_body(data, files)
File "/Library/Python/2.7/site-packages/requests/models.py", line 416, in prepare_body
(body, content_type) = self._encode_files(files, data)
File "/Library/Python/2.7/site-packages/requests/models.py", line 141, in _encode_files
rf.make_multipart(content_type=ft)
File "/Library/Python/2.7/site-packages/requests/packages/urllib3/fields.py", line 175, in make_multipart
self.headers['Content-Disposition'] += '; '.join(['', self._render_parts((('name', self._name), ('filename', self._filename)))])
File "/Library/Python/2.7/site-packages/requests/packages/urllib3/fields.py", line 138, in _render_parts
parts.append(self._render_part(name, value))
File "/Library/Python/2.7/site-packages/requests/packages/urllib3/fields.py", line 118, in _render_part
return format_header_param(name, value)
File "/Library/Python/2.7/site-packages/requests/packages/urllib3/fields.py", line 43, in format_header_param
result.encode('ascii')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 10: ordinal not in range(128)
The text was updated successfully, but these errors were encountered: