Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

Commit

Permalink
Merge pull request #2 from anup5512/url_encoding_fix
Browse files Browse the repository at this point in the history
Fixed quote() breaking 'list' subcommand
  • Loading branch information
anup5512 committed May 24, 2018
2 parents 2cd50e4 + 6d57ff6 commit 0aa45fd
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions bin/rabbitmqadmin
Expand Up @@ -40,13 +40,15 @@ if sys.version_info[0] == 2:
from ConfigParser import ConfigParser, NoSectionError
import httplib
import urlparse
from urllib import quote_plus
from urllib import quote
def b64(s):
return base64.b64encode(s)
else:
from configparser import ConfigParser, NoSectionError
import http.client as httplib
import urllib.parse as urlparse
from urllib.parse import quote_plus
from urllib.parse import quote
def b64(s):
return base64.b64encode(s.encode('utf-8')).decode('utf-8')
Expand Down Expand Up @@ -613,7 +615,7 @@ class Management:
path = self.get_arg()
uri = "/definitions"
if self.options.vhost:
uri += "/%s" % quote(self.options.vhost)
uri += "/%s" % quote_plus(self.options.vhost)
definitions = self.get(uri)
f = open(path, 'w')
f.write(definitions)
Expand All @@ -628,7 +630,7 @@ class Management:
f.close()
uri = "/definitions"
if self.options.vhost:
uri += "/%s" % quote(self.options.vhost)
uri += "/%s" % quote_plus(self.options.vhost)
self.post(uri, definitions)
self.verbose("Imported definitions for %s from \"%s\""
% (self.options.hostname, path))
Expand All @@ -655,7 +657,7 @@ class Management:
uri = "/%s" % self._list_path_for_obj_type(obj_type)
query = []
if obj_info['vhost'] and self.options.vhost:
uri += "/%s" % quote(self.options.vhost)
uri += "/%s" % quote_plus(self.options.vhost)
cols = self.args[1:]
if cols == [] and 'cols' in obj_info and self.use_cols():
cols = obj_info['cols']
Expand Down

0 comments on commit 0aa45fd

Please sign in to comment.