Move unicode conversion higher up.

This commit is contained in:
Itamar Turner-Trauring 2021-05-04 10:00:27 -04:00
parent ae739dfd9e
commit 7349855ce4
2 changed files with 4 additions and 2 deletions
src/allmydata/scripts

@ -27,6 +27,8 @@ def list(options):
except UnknownAliasError as e:
e.display(stderr)
return 1
path = unicode(path, "utf-8")
url = nodeurl + "uri/%s" % url_quote(rootcap)
if path:
# move where.endswith check here?
@ -64,7 +66,6 @@ def list(options):
print(quote_output(data, quotemarks=False), file=stderr)
return 1
path = unicode(path, "utf-8")
nodetype, d = parsed
children = {}
if nodetype == "dirnode":

@ -27,6 +27,7 @@ def mv(options, mode="move"):
except UnknownAliasError as e:
e.display(stderr)
return 1
from_path = unicode(from_path, "utf-8")
from_url = nodeurl + "uri/%s" % url_quote(rootcap)
if from_path:
from_url += "/" + escape_path(from_path)
@ -46,10 +47,10 @@ def mv(options, mode="move"):
e.display(stderr)
return 1
to_url = nodeurl + "uri/%s" % url_quote(rootcap)
path = unicode(path, "utf-8")
if path:
to_url += "/" + escape_path(path)
from_path = unicode(from_path, "utf-8")
if to_url.endswith("/"):
# "mv foo.txt bar/" == "mv foo.txt bar/foo.txt"
to_url += escape_path(from_path[from_path.rfind("/")+1:])