cli: use urllib.quote() on vdrive-path arguments before passing them through HTTP
authorZooko O'Whielacronx <zooko@zooko.com>
Sat, 27 Oct 2007 01:30:44 +0000 (18:30 -0700)
committerZooko O'Whielacronx <zooko@zooko.com>
Sat, 27 Oct 2007 01:30:44 +0000 (18:30 -0700)
src/allmydata/scripts/tahoe_get.py
src/allmydata/scripts/tahoe_ls.py
src/allmydata/scripts/tahoe_mv.py
src/allmydata/scripts/tahoe_put-web2ish.py
src/allmydata/scripts/tahoe_put.py
src/allmydata/scripts/tahoe_rm.py

index 267737953158901832974e1af744c024b51dd906..4efa3da613a0baeaac56e6d6ab97fa3c0adab662 100644 (file)
@@ -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
index bd68c0dd95c26f09f38e1818bb313037d3565110..259cf4a67c3fef4fe2544e7178ea94f3fd9aaf3a 100644 (file)
@@ -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()
 
index 2bb49c4e6bbb977be39f61b06b46ffd0dd6080c0..fd28c3a66857ac9709922e8172b1b0d2ded7e032 100644 (file)
@@ -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("/","!"))
index a6e88b9025840a26ba06076409ebf2117131b4a0..86e5616655dfe2a6244a415beef6cc220c051ebe 100644 (file)
@@ -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
index 244e5e2af3a1bcf12c69f16043fb95f92fc74604..1644c5af4f58f80d86167fc740eafcddd4ddadb1 100644 (file)
@@ -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)
index abc58542055089d62a5f5f3d91a28a5d3f9996be..7795221247a4a397030a27a8144b256a0b1c5791 100644 (file)
@@ -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)