diff --git a/cinder/api/common.py b/cinder/api/common.py index 23479ca5957..e357785aed5 100644 --- a/cinder/api/common.py +++ b/cinder/api/common.py @@ -202,7 +202,7 @@ def remove_version_from_href(href): """ parsed_url = urllib.parse.urlsplit(href) - url_parts = parsed_url.path.split('/', 2) + url_parts = parsed_url.path.split('/') # NOTE: this should match vX.X or vX expression = re.compile(r'^v([0-9]+|[0-9]+\.[0-9]+)(/.*|$)') diff --git a/cinder/tests/unit/api/test_common.py b/cinder/tests/unit/api/test_common.py index 242ec2de812..84cce1997d1 100644 --- a/cinder/tests/unit/api/test_common.py +++ b/cinder/tests/unit/api/test_common.py @@ -261,7 +261,9 @@ class MiscFunctionsTest(test.TestCase): ('http://cinder.example.com/v1.1/images/v10.5', 'http://cinder.example.com/images/v10.5'), ('http://cinder.example.com/cinder/v2', - 'http://cinder.example.com/cinder')) + 'http://cinder.example.com/cinder'), + ('http://cinder.example.com/volume/v2/123', + 'http://cinder.example.com/volume/123')) @ddt.unpack def test_remove_version_from_href(self, fixture, expected): """Test for removing version from href