diff --git a/test/test_endpoints.py b/test/test_endpoints.py index 256b54bd4..88da7270a 100644 --- a/test/test_endpoints.py +++ b/test/test_endpoints.py @@ -134,6 +134,9 @@ class WebEndpointTestCase(EndpointTestCase): def test_repo_view(self): self.getResponse('web.repository', path='devtable/simple') + def test_unicode_repo_view(self): + self.getResponse('web.repository', path='%E2%80%8Bcoreos/hyperkube%E2%80%8B') + def test_org_view(self): self.getResponse('web.org_view', path='buynlarge') diff --git a/util/names.py b/util/names.py index e25eaa1c0..9fb6f3064 100644 --- a/util/names.py +++ b/util/names.py @@ -1,6 +1,8 @@ import urllib import re +import anunidecode # Don't listen to pylint's lies. This import is required for unidecode below. + from uuid import uuid4 REPOSITORY_NAME_REGEX = re.compile(r'^[\.a-zA-Z0-9_-]+$') @@ -23,6 +25,8 @@ def escape_tag(tag, default='latest'): def parse_namespace_repository(repository, library_namespace, include_tag=False): + repository = repository.encode('unidecode', 'ignore') + parts = repository.rstrip('/').split('/', 1) if len(parts) < 2: namespace = library_namespace