Skip to content
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

Properly handle weird filenames #41

Closed
Erethon opened this issue Jul 23, 2014 · 1 comment
Closed

Properly handle weird filenames #41

Erethon opened this issue Jul 23, 2014 · 1 comment

Comments

@Erethon
Copy link
Contributor

Erethon commented Jul 23, 2014

At the moment, kamaki crashes if it encounters a filename with weird characters.

d@C:/tmp/roz$ echo "This is a kamaki test" > $(dd if=/dev/urandom bs=5 count=1)
1+0 records in
1+0 records out
5 bytes (5 B) copied, 2.2886e-05 s, 218 kB/s
d@C:/tmp/roz$ ls
??(\?
d@C:/tmp/roz$ cat ¬Â\(\\÷ 
This is a kamaki test
d@C:/tmp/roz$ kamaki file upload ¬Â\(\\÷ 
Unknown Error: 'utf8' codec can't decode byte 0xac in position 0: invalid start byte
@vkoukis
Copy link
Contributor

vkoukis commented Jul 30, 2014

Implementing the Swift API means kamaki has to pass filenames as part of HTTP URLs.
To do that, it first encodes the filename string as UTF-8, then URL-encodes it, to make it part of the URL.

This means it has to know the encoding of a filename passed to it at the command line.
It assumes the encoding matches the locale settings of the user.

If your locale settings specify UTF8 as your preferred encoding, then the problem is that the filename you are specifying is not valid UTF8. If this is the case, then the error message should change to better reflect this, e.g., "The string '...' is not valid based on your locale settings (codec: 'utf8').".

saxtouri added a commit to saxtouri/kamaki that referenced this issue Jul 30, 2014
Fixes grnet#41

This bug was located at the code that parses the command terms.
If a term is invalid with respect to the current locale settings,
an "Unknown error" was being raised.
Kamaki is now reporting a descriptive error with a reference to
the faulty term.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants