Remove unicode before sending it to path parser
Fixes https://sentry.io/coreos/backend-production/issues/175929456/
This commit is contained in:
parent
3f1d394e14
commit
7cc7e54945
2 changed files with 7 additions and 0 deletions
|
@ -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')
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Reference in a new issue