linkifiers: Allow semicolons in target URLs.

This fixes another user report.  The right fix is to convert this to
use a normal URL validator after substitution.
This commit is contained in:
Tim Abbott 2019-05-14 11:17:41 -07:00
parent a06f35182d
commit dc2aa031f6
2 changed files with 2 additions and 2 deletions

View File

@ -656,7 +656,7 @@ def filter_pattern_validator(value: str) -> None:
raise ValidationError(error_msg)
def filter_format_validator(value: str) -> None:
regex = re.compile(r'^([\.\/:a-zA-Z0-9#_?=&-]+%\(([a-zA-Z0-9_-]+)\)s)+[/a-zA-Z0-9#_?=&-]*$')
regex = re.compile(r'^([\.\/:a-zA-Z0-9#_?=&;-]+%\(([a-zA-Z0-9_-]+)\)s)+[/a-zA-Z0-9#_?=&;-]*$')
if not regex.match(value):
raise ValidationError(_('Invalid URL format string.'))

View File

@ -82,7 +82,7 @@ class RealmFilterTest(ZulipTestCase):
self.assertIsNotNone(re.match(data['pattern'], 'lp:123'))
data['pattern'] = r'!(?P<id>[0-9]+)'
data['url_format_string'] = 'https://realm.com/my_realm_filter/?value=%(id)s'
data['url_format_string'] = 'https://realm.com/index.pl?Action=AgentTicketZoom;TicketNumber=%(id)s'
result = self.client_post("/json/realm/filters", info=data)
self.assert_json_success(result)
self.assertIsNotNone(re.match(data['pattern'], '!123'))