git-ftp icon indicating copy to clipboard operation
git-ftp copied to clipboard

Unable to upload files named by multibyte characters

Open japboy opened this issue 13 years ago • 2 comments

My repository has a file named in Japanese こんにちは.txt and I got an error while git-ftp was trying to upload the file via FTP:

$ git push origin
Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 331 bytes, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: INFO: Using .git/ftpdata
remote: INFO: Base directory is /htdocs/ftp
remote: INFO: Uploading Hello.txt
remote: Traceback (most recent call last):
remote:   File "/usr/local/bin/git-ftp", line 364, in <module>
remote:     main()
remote:   File "/usr/local/bin/git-ftp", line 114, in main
remote:     upload_diff(repo, oldtree, tree, ftp, base)
remote:   File "/usr/local/bin/git-ftp", line 285, in upload_diff
remote:     node = tree[file]
remote:   File "/usr/local/python/lib/python2.7/site-packages/git/objects/tree.py", line 237, in __getitem__
remote:     return self.__div__(item)
remote:   File "/usr/local/python/lib/python2.7/site-packages/git/objects/tree.py", line 190, in __div__
remote:     raise KeyError( msg % file )
remote: KeyError: 'Blob or Tree named \'"\\\\343\\\\201\\\\223\\\\343\\\\202\\\\223\\\\343\\\\201\\\\253\\\\343\\\\201\\\\241\\\\343\\\\201\\\\257.txt"\' not found'
To [email protected]:git/sandbox.git
   e867eb3..21b1e92  master -> master

I hope this will be fixed. Thanks in advance.

japboy avatar Apr 16 '12 10:04 japboy

This sounds like a tricky bug to diagnose; there are lots of places where the failure has happened. It might take a while for me to find a fix.

ezyang avatar Apr 17 '12 18:04 ezyang

GitPython uses UTF-8 for paths, maybe we can enforce it: … status, file = line.split("\t", 1) file = unicode(file, 'UTF-8') …

peteruhnak avatar Apr 19 '12 11:04 peteruhnak