diff --git a/artifactory.py b/artifactory.py index 4325018..69bc540 100755 --- a/artifactory.py +++ b/artifactory.py @@ -410,13 +410,13 @@ def quote_url(url): parsed_url = urllib3.util.parse_url(url) if parsed_url.port: quoted_path = requests.utils.quote( - url.rpartition(f"{parsed_url.host}:{parsed_url.port}")[2] + url.partition(f"{parsed_url.host}:{parsed_url.port}")[2] ) quoted_url = ( f"{parsed_url.scheme}://{parsed_url.host}:{parsed_url.port}{quoted_path}" ) else: - quoted_path = requests.utils.quote(url.rpartition(parsed_url.host)[2]) + quoted_path = requests.utils.quote(url.partition(parsed_url.host)[2]) quoted_url = f"{parsed_url.scheme}://{parsed_url.host}{quoted_path}" return quoted_url diff --git a/tests/unit/test_artifactory_path.py b/tests/unit/test_artifactory_path.py index f2f57d9..16e528d 100644 --- a/tests/unit/test_artifactory_path.py +++ b/tests/unit/test_artifactory_path.py @@ -100,6 +100,10 @@ def test_quote_url(self): check( "https://example.com/artifactory/foo", "https://example.com/artifactory/foo" ) + check( + "https://example.com/artifactory/foo/example.com/bar", + "https://example.com/artifactory/foo/example.com/bar" + ) check( "https://example.com/artifactory/foo/#1", "https://example.com/artifactory/foo/%231",