From 81e08209048d77d0dbe7ab3d158aa3a5f12f7fcc Mon Sep 17 00:00:00 2001 From: Zooko O'Whielacronx Date: Fri, 26 Oct 2007 18:30:44 -0700 Subject: [PATCH] cli: use urllib.quote() on vdrive-path arguments before passing them through HTTP --- src/allmydata/scripts/tahoe_get.py | 2 +- src/allmydata/scripts/tahoe_ls.py | 2 +- src/allmydata/scripts/tahoe_mv.py | 2 ++ src/allmydata/scripts/tahoe_put-web2ish.py | 2 +- src/allmydata/scripts/tahoe_put.py | 2 +- src/allmydata/scripts/tahoe_rm.py | 2 +- 6 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/allmydata/scripts/tahoe_get.py b/src/allmydata/scripts/tahoe_get.py index 26773795..4efa3da6 100644 --- a/src/allmydata/scripts/tahoe_get.py +++ b/src/allmydata/scripts/tahoe_get.py @@ -7,7 +7,7 @@ def get(nodeurl, root_uri, vdrive_fname, local_file, stdout, stderr): nodeurl += "/" url = nodeurl + "uri/%s/" % urllib.quote(root_uri.replace("/","!")) if vdrive_fname: - url += vdrive_fname + url += urllib.quote(vdrive_fname) if local_file is None or local_file == "-": outf = stdout diff --git a/src/allmydata/scripts/tahoe_ls.py b/src/allmydata/scripts/tahoe_ls.py index bd68c0dd..259cf4a6 100644 --- a/src/allmydata/scripts/tahoe_ls.py +++ b/src/allmydata/scripts/tahoe_ls.py @@ -8,7 +8,7 @@ def list(nodeurl, root_uri, vdrive_pathname, stdout, stderr): nodeurl += "/" url = nodeurl + "uri/%s/" % urllib.quote(root_uri.replace("/","!")) if vdrive_pathname: - url += vdrive_pathname + url += urllib.quote(vdrive_pathname) url += "?t=json" data = urllib.urlopen(url).read() diff --git a/src/allmydata/scripts/tahoe_mv.py b/src/allmydata/scripts/tahoe_mv.py index 2bb49c4e..fd28c3a6 100644 --- a/src/allmydata/scripts/tahoe_mv.py +++ b/src/allmydata/scripts/tahoe_mv.py @@ -6,6 +6,8 @@ import simplejson from allmydata.scripts.common_http import do_http def mv(nodeurl, root_uri, frompath, topath, stdout, stderr): + frompath = urllib.quote(frompath) + topath = urllib.quote(topath) if nodeurl[-1] != "/": nodeurl += "/" url = nodeurl + "uri/%s/" % urllib.quote(root_uri.replace("/","!")) diff --git a/src/allmydata/scripts/tahoe_put-web2ish.py b/src/allmydata/scripts/tahoe_put-web2ish.py index a6e88b90..86e56166 100644 --- a/src/allmydata/scripts/tahoe_put-web2ish.py +++ b/src/allmydata/scripts/tahoe_put-web2ish.py @@ -24,7 +24,7 @@ def _put(serverurl, vdrive_fname, local_fname, verbosity): url = "/vdrive/global/" if vdrive_fname: - url += vdrive_fname + url += urllib.quote(vdrive_fname) if local_fname is None or local_fname == "-": infileobj = sys.stdin diff --git a/src/allmydata/scripts/tahoe_put.py b/src/allmydata/scripts/tahoe_put.py index 244e5e2a..1644c5af 100644 --- a/src/allmydata/scripts/tahoe_put.py +++ b/src/allmydata/scripts/tahoe_put.py @@ -14,7 +14,7 @@ def put(nodeurl, root_uri, local_fname, vdrive_fname, verbosity, nodeurl += "/" url = nodeurl + "uri/%s/" % urllib.quote(root_uri.replace("/","!")) if vdrive_fname: - url += vdrive_fname + url += urllib.quote(vdrive_fname) infileobj = open(local_fname, "rb") resp = do_http("PUT", url, infileobj) diff --git a/src/allmydata/scripts/tahoe_rm.py b/src/allmydata/scripts/tahoe_rm.py index abc58542..77952212 100644 --- a/src/allmydata/scripts/tahoe_rm.py +++ b/src/allmydata/scripts/tahoe_rm.py @@ -13,7 +13,7 @@ def rm(nodeurl, root_uri, vdrive_pathname, verbosity, stdout, stderr): nodeurl += "/" url = nodeurl + "uri/%s/" % urllib.quote(root_uri.replace("/","!")) if vdrive_pathname: - url += vdrive_pathname + url += urllib.quote(vdrive_pathname) resp = do_http("DELETE", url) -- 2.45.2