Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gajim/common/styling.py3
-rw-r--r--test/no_gui/test_styling.py16
2 files changed, 13 insertions, 6 deletions
diff --git a/gajim/common/styling.py b/gajim/common/styling.py
index 31ff5be8a..68b2c931a 100644
--- a/gajim/common/styling.py
+++ b/gajim/common/styling.py
@@ -50,7 +50,8 @@ BLOCK_RX = re.compile(PRE_RX + '|' + QUOTE_RX, re.S | re.M)
BLOCK_NESTED_RX = re.compile(PRE_NESTED_RX + '|' + QUOTE_RX, re.S | re.M)
UNQUOTE_RX = re.compile(r'^> |^>', re.M)
-URI_OR_JID_RX = re.compile(fr'(?P<uri>{regex.IRI})|(?P<jid>{regex.XMPP.jid})')
+URI_OR_JID_RX = re.compile(
+ fr'(?P<uri>(?<![\w+.-]){regex.IRI})|(?P<jid>{regex.XMPP.jid})')
EMOJI_RX = emoji_data.get_regex()
EMOJI_RX = re.compile(EMOJI_RX)
diff --git a/test/no_gui/test_styling.py b/test/no_gui/test_styling.py
index 8799b8e6e..5f3b8caf1 100644
--- a/test/no_gui/test_styling.py
+++ b/test/no_gui/test_styling.py
@@ -389,6 +389,14 @@ NONURIS = [
' ',
'.',
':',
+ '://',
+ 'Böblingen:🌥',
+ 'Bo\u0308blingen:🌥', # finds blingen:🌥 but rejects an unregistered scheme
+ 'path/to/file_na.me:123',
+ '_sche.me:body_',
+ '_sche+me:body_',
+ '.scheme:body',
+ '+scheme:body',
# These are from https://mathiasbynens.be/demo/url-regex
'//',
@@ -396,10 +404,6 @@ NONURIS = [
'///a',
'///',
'foo.com',
- 'http://foo.bar?q=Spaces should be encoded',
- 'http:// shouldfail.com',
- ':// should fail',
- 'http://foo.bar/foo(bar)baz quux',
]
@@ -491,7 +495,6 @@ NONJIDS = [
# These are from https://rfc-editor.org/rfc/rfc7622#section-3.5
'"juliet"@example.com',
- 'foo bar@example.com', # search is expected to find 'bar@example.com'
'@example.com',
'henryⅣ@example.com', # localpart has a compatibility-decomposable cp
'♚@example.com', # localpart has a symbol cp
@@ -507,6 +510,9 @@ URIS_WITH_TEXT = [
('<http://userid@example.com/>', ['http://userid@example.com/']),
('"http://userid@example.com/"', ['http://userid@example.com/']),
('regexes are useless (see https://en.wikipedia.org/wiki/Recursion_(computer_science)), but comfy', ['https://en.wikipedia.org/wiki/Recursion_(computer_science)']),
+ ('(scheme:body)', ['scheme:body']),
+ ('/scheme:body', ['scheme:body']),
+ ('!scheme:body', ['scheme:body']),
]