cli: use urllib.escape on all URIs

This commit is contained in:
Brian Warner 2007-10-11 01:34:44 -07:00
parent 5b28411b04
commit a470947cc3
4 changed files with 6 additions and 6 deletions

View File

@ -5,7 +5,7 @@ import sys, urllib
def get(nodeurl, root_uri, vdrive_fname, local_file):
if nodeurl[-1] != "/":
nodeurl += "/"
url = nodeurl + "uri/%s/" % root_uri.replace("/","!")
url = nodeurl + "uri/%s/" % urllib.quote(root_uri.replace("/","!"))
if vdrive_fname:
url += vdrive_fname

View File

@ -6,7 +6,7 @@ import simplejson
def list(nodeurl, root_uri, vdrive_pathname):
if nodeurl[-1] != "/":
nodeurl += "/"
url = nodeurl + "uri/%s/" % root_uri.replace("/","!")
url = nodeurl + "uri/%s/" % urllib.quote(root_uri.replace("/","!"))
if vdrive_pathname:
url += vdrive_pathname
url += "?t=json"

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python
import re, socket
import re, socket, urllib
NODEURL_RE=re.compile("http://([^:]*)(:([1-9][0-9]*))?")
@ -14,7 +14,7 @@ def put(nodeurl, root_uri, local_fname, vdrive_fname, verbosity):
host = mo.group(1)
port = int(mo.group(3))
url = "/uri/%s/" % root_uri.replace("/","!")
url = "/uri/%s/" % urllib.quote(root_uri.replace("/","!"))
if vdrive_fname:
url += vdrive_fname

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python
import re, socket
import re, socket, urllib
NODEURL_RE=re.compile("http://([^:]*)(:([1-9][0-9]*))?")
@ -14,7 +14,7 @@ def rm(nodeurl, root_uri, vdrive_pathname, verbosity):
host = mo.group(1)
port = int(mo.group(3))
url = "/uri/%s/" % root_uri.replace("/","!")
url = "/uri/%s/" % urllib.quote(root_uri.replace("/","!"))
if vdrive_pathname:
url += vdrive_pathname