mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-21 02:01:31 +00:00
macfuse: fix unicode handling
at one point I'd thrown in a 'str' since fuse api bits required a str instance but tahoe returns unicode objects from its json parsing. that, naturally enough should really be a utf8 encoded str of the unicode object...
This commit is contained in:
parent
6177a958d0
commit
4bbaaff49f
@ -4,6 +4,7 @@
|
||||
from allmydata.uri import CHKFileURI, NewDirectoryURI, LiteralFileURI
|
||||
from allmydata.scripts.common_http import do_http as do_http_req
|
||||
from allmydata.util.hashutil import tagged_hash
|
||||
from allmydata.util.assertutil import precondition
|
||||
from allmydata.util import base32
|
||||
|
||||
import base64
|
||||
@ -46,6 +47,10 @@ def log(msg):
|
||||
|
||||
fuse.flog = log
|
||||
|
||||
def unicode_to_utf8(u):
|
||||
precondition(isinstance(u, unicode), repr(u))
|
||||
return u.encode('utf-8')
|
||||
|
||||
def do_http(method, url, body=''):
|
||||
resp = do_http_req(method, url, body)
|
||||
log('do_http(%s, %s) -> %s, %s' % (method, url, resp.status, resp.reason))
|
||||
@ -487,7 +492,7 @@ class Directory(object):
|
||||
assert nodetype == 'dirnode'
|
||||
self.children.clear()
|
||||
for cname,details in d['children'].items():
|
||||
cname = str(cname)
|
||||
cname = unicode_to_utf8(cname)
|
||||
ctype, cattrs = details
|
||||
metadata = cattrs.get('metadata', {})
|
||||
if ctype == 'dirnode':
|
||||
|
Loading…
x
Reference in New Issue
Block a user