Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

linkifiers: Allow tildes in target URLs.

Alex Vandiverdb8daf417586
diff --git a/zerver/models.py b/zerver/models.py
index cd61db194bd..da11d024ab8 100644
--- a/zerver/models.py
+++ b/zerver/models.py
@@ -734,7 +734,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.'))
diff --git a/zerver/tests/test_realm_filters.py b/zerver/tests/test_realm_filters.py
index 7b93ece2c59..a73319eb845 100644
--- a/zerver/tests/test_realm_filters.py
+++ b/zerver/tests/test_realm_filters.py
@@ -61,7 +61,7 @@ class RealmFilterTest(ZulipTestCase):
self.assertIsNotNone(re.match(data['pattern'], '_code=123abcdZ'))
data['pattern'] = r'PR (?P<id>[0-9]+)'
- data['url_format_string'] = 'https://example.com/web#view_type=type&model=model&action=12345&id=%(id)s'
+ data['url_format_string'] = 'https://example.com/~user/web#view_type=type&model=model&action=12345&id=%(id)s'
result = self.client_post("/json/realm/filters", info=data)
self.assert_json_success(result)
self.assertIsNotNone(re.match(data['pattern'], 'PR 123'))