diff options
author | Joffrey F <joffrey@docker.com> | 2017-12-13 18:32:59 -0800 |
---|---|---|
committer | Joffrey F <joffrey@docker.com> | 2017-12-13 18:32:59 -0800 |
commit | 7db76737ca661f242f9345a2be9a317c79da7575 (patch) | |
tree | 9a74ef36d385f30bf30f47efc378c57a84dee881 | |
parent | d8f996f969e9f8c8ef0c0409d2ee1d458dc2c46f (diff) | |
download | docker-py-7db76737ca661f242f9345a2be9a317c79da7575.tar.gz |
Fix URL-quoting for resource names containing spaces1758-url-quote-path
Signed-off-by: Joffrey F <joffrey@docker.com>
-rw-r--r-- | docker/api/client.py | 2 | ||||
-rw-r--r-- | tests/integration/api_network_test.py | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/docker/api/client.py b/docker/api/client.py index cbe74b9..01a83ea 100644 --- a/docker/api/client.py +++ b/docker/api/client.py @@ -206,7 +206,7 @@ class APIClient( 'instead'.format(arg, type(arg)) ) - quote_f = partial(six.moves.urllib.parse.quote_plus, safe="/:") + quote_f = partial(six.moves.urllib.parse.quote, safe="/:") args = map(quote_f, args) if kwargs.get('versioned_api', True): diff --git a/tests/integration/api_network_test.py b/tests/integration/api_network_test.py index f4fefde..10e09dd 100644 --- a/tests/integration/api_network_test.py +++ b/tests/integration/api_network_test.py @@ -484,3 +484,10 @@ class TestNetworks(BaseAPIIntegrationTest): assert self.client.inspect_network(net_name_swarm, scope='swarm') with pytest.raises(docker.errors.NotFound): self.client.inspect_network(net_name_swarm, scope='local') + + @requires_api_version('1.21') + def test_create_remove_network_with_space_in_name(self): + net_id = self.client.create_network('test 01') + self.tmp_networks.append(net_id) + assert self.client.inspect_network('test 01') + assert self.client.remove_network('test 01') is None # does not raise |