Merge pull request #2771 from lbryio/update_url_regex
update url regex to include missing cases
This commit is contained in:
commit
3757124323
3 changed files with 8 additions and 8 deletions
|
@ -7,7 +7,7 @@ def _create_url_regex():
|
||||||
# see https://spec.lbry.com/ and test_url.py
|
# see https://spec.lbry.com/ and test_url.py
|
||||||
invalid_names_regex = \
|
invalid_names_regex = \
|
||||||
r"[^=&#:$@%?;\"/\\<>%{}|^~`\[\]" \
|
r"[^=&#:$@%?;\"/\\<>%{}|^~`\[\]" \
|
||||||
r"\u0000-\u0008\u000b-\u000c\u000e-\u001F\uD800-\uDFFF\uFFFE-\uFFFF]+"
|
r"\u0000-\u0020\uD800-\uDFFF\uFFFE-\uFFFF]+"
|
||||||
|
|
||||||
def _named(name, regex):
|
def _named(name, regex):
|
||||||
return "(?P<" + name + ">" + regex + ")"
|
return "(?P<" + name + ">" + regex + ")"
|
||||||
|
|
|
@ -365,7 +365,7 @@ class CommentCommands(CommandTestCase):
|
||||||
|
|
||||||
async def test04_comment_abandons(self):
|
async def test04_comment_abandons(self):
|
||||||
rswanson = (await self.channel_create('@RonSwanson'))['outputs'][0]
|
rswanson = (await self.channel_create('@RonSwanson'))['outputs'][0]
|
||||||
stream = (await self.stream_create('Pawnee Town Hall of Fame by Leslie Knope'))['outputs'][0]
|
stream = (await self.stream_create('Pawnee_Tow_Hall_of_Fame_by_Leslie_Knope'))['outputs'][0]
|
||||||
comment = await self.daemon.jsonrpc_comment_create(
|
comment = await self.daemon.jsonrpc_comment_create(
|
||||||
comment='KNOPE! WHAT DID I TELL YOU ABOUT PUTTING MY INFORMATION UP LIKE THAT',
|
comment='KNOPE! WHAT DID I TELL YOU ABOUT PUTTING MY INFORMATION UP LIKE THAT',
|
||||||
claim_id=stream['claim_id'],
|
claim_id=stream['claim_id'],
|
||||||
|
@ -383,7 +383,7 @@ class CommentCommands(CommandTestCase):
|
||||||
moth = (await self.channel_create('@InconspicuousMoth'))['outputs'][0]
|
moth = (await self.channel_create('@InconspicuousMoth'))['outputs'][0]
|
||||||
bee = (await self.channel_create('@LazyBumblebee'))['outputs'][0]
|
bee = (await self.channel_create('@LazyBumblebee'))['outputs'][0]
|
||||||
moth_id = moth['claim_id']
|
moth_id = moth['claim_id']
|
||||||
stream = await self.stream_create('Cool Lamps to Sit On', channel_id=moth_id)
|
stream = await self.stream_create('Cool_Lamps_to_Sit_On', channel_id=moth_id)
|
||||||
claim_id = stream['outputs'][0]['claim_id']
|
claim_id = stream['outputs'][0]['claim_id']
|
||||||
|
|
||||||
comment1 = await self.daemon.jsonrpc_comment_create(
|
comment1 = await self.daemon.jsonrpc_comment_create(
|
||||||
|
@ -440,7 +440,7 @@ class CommentCommands(CommandTestCase):
|
||||||
moth = (await self.channel_create('@InconspicuousMoth'))['outputs'][0]
|
moth = (await self.channel_create('@InconspicuousMoth'))['outputs'][0]
|
||||||
bee = (await self.channel_create('@LazyBumblebee'))['outputs'][0]
|
bee = (await self.channel_create('@LazyBumblebee'))['outputs'][0]
|
||||||
moth_id = moth['claim_id']
|
moth_id = moth['claim_id']
|
||||||
stream = await self.stream_create('Cool Lamps to Sit On', channel_id=moth_id)
|
stream = await self.stream_create('Cool_Lamps_to_Sit_On', channel_id=moth_id)
|
||||||
claim_id = stream['outputs'][0]['claim_id']
|
claim_id = stream['outputs'][0]['claim_id']
|
||||||
hidden_comment = await self.daemon.jsonrpc_comment_create(
|
hidden_comment = await self.daemon.jsonrpc_comment_create(
|
||||||
comment='Who on earth would want to sit around on a lamp all day',
|
comment='Who on earth would want to sit around on a lamp all day',
|
||||||
|
|
|
@ -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')
|
url(f'lbry://@test#{claim_id}/stuff', channel_name='@test', channel_claim_id=claim_id, stream_name='stuff')
|
||||||
# unicode regex edges
|
# unicode regex edges
|
||||||
_url = lambda name: url(name, stream_name=name)
|
_url = lambda name: url(name, stream_name=name)
|
||||||
_url('\u0009')
|
|
||||||
_url('\u000a')
|
|
||||||
_url('\u000d')
|
|
||||||
_url('\u0020')
|
|
||||||
_url('\uD799')
|
_url('\uD799')
|
||||||
_url('\uE000')
|
_url('\uE000')
|
||||||
_url('\uFFFD')
|
_url('\uFFFD')
|
||||||
|
@ -79,6 +75,10 @@ class TestURLParsing(unittest.TestCase):
|
||||||
fail("lbry://\uDFFE")
|
fail("lbry://\uDFFE")
|
||||||
fail("lbry://\uFFFF")
|
fail("lbry://\uFFFF")
|
||||||
fail("lbry://;")
|
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://\\")
|
fail("lbry://\\")
|
||||||
fail("lbry:///")
|
fail("lbry:///")
|
||||||
|
|
Loading…
Reference in a new issue