Merge pull request #1835 from docker/1758-url-quote-path

Fix URL-quoting for resource names containing spaces
This commit is contained in:
Joffrey F 2017-12-13 19:09:13 -08:00 committed by GitHub
commit 20b5b58bb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -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):

View File

@ -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