-------------------------------------------
if self.endpoint_path:
url = '%s/%s' % (self.endpoint_path, url) conn_url = posixpath.normpath(url)
----------------------------------------------------
to
-------------------------------------------------------------
if self.endpoint_path:
url = urlparse.urljoin(self.endpoint_path, url) conn_url = urlparse.urlsplit(url).geturl()
Actually, the urlparse.urljoin() can not work as the code '%s/%s' % (self.endpoint_path, url), for example, when the self.endpoint_path is '/87823490349243', the url is '/v1/images/details', the output is different for these two line codes.
output for '%s/%s' % (self.endpoint_path, url) is /87823490349243/v1/images/details, but output for url = '%s/%s' % (self.endpoint_path, url) is only v1/images/details.
There is a bug below reported in python-glanceclient to remove the posixpath, but the fix has brought a new regression bug.
https:/ /bugs.launchpad .net/python- glanceclient/ +bug/1208618
The code has been changed from
------- ------- ------- ------- ------- ------- - path, url)
conn_ url = posixpath. normpath( url) ------- ------- ------- ------- ------- ------- --- ------- ------- ------- ------- ------- ------- ------- ----- urljoin( self.endpoint_ path, url)
conn_ url = urlparse. urlsplit( url).geturl( )
if self.endpoint_path:
url = '%s/%s' % (self.endpoint_
-------
to
-------
if self.endpoint_path:
url = urlparse.
Actually, the urlparse.urljoin() can not work as the code '%s/%s' % (self.endpoint_ path, url), for example, when the self.endpoint_path is '/87823490349243', the url is '/v1/images/ details' , the output is different for these two line codes.
output for '%s/%s' % (self.endpoint_ path, url) is /87823490349243 /v1/images/ details, but output for url = '%s/%s' % (self.endpoint_ path, url) is only v1/images/details.