update url regex to cases tom reported

This commit is contained in:
Victor Shyba 2020-02-06 15:49:23 -03:00 committed by Lex Berezhny
parent dadc004dd6
commit f14004e56b
2 changed files with 5 additions and 5 deletions

View file

@ -7,7 +7,7 @@ def _create_url_regex():
# see https://spec.lbry.com/ and test_url.py
invalid_names_regex = \
r"[^=&#:$@%?;\"/\\<>%{}|^~`\[\]" \
r"\u0000-\u0008\u000b-\u000c\u000e-\u001F\uD800-\uDFFF\uFFFE-\uFFFF]+"
r"\u0000-\u0020\uD800-\uDFFF\uFFFE-\uFFFF]+"
def _named(name, regex):
return "(?P<" + name + ">" + regex + ")"

View file

@ -57,10 +57,6 @@ class TestURLParsing(unittest.TestCase):
url(f'lbry://@test#{claim_id}/stuff', channel_name='@test', channel_claim_id=claim_id, stream_name='stuff')
# unicode regex edges
_url = lambda name: url(name, stream_name=name)
_url('\u0009')
_url('\u000a')
_url('\u000d')
_url('\u0020')
_url('\uD799')
_url('\uE000')
_url('\uFFFD')
@ -79,6 +75,10 @@ class TestURLParsing(unittest.TestCase):
fail("lbry://\uDFFE")
fail("lbry://\uFFFF")
fail("lbry://;")
fail("lbry://no\ttab")
fail("lbry://no space")
fail("lbry://no\rcr")
fail("lbry://no\new\nline")
fail("lbry://\"")
fail("lbry://\\")
fail("lbry:///")