Philipp Hörist pushed to branch master at gajim / gajim


Commits:
404d221d by mesonium at 2025-08-03T22:31:31+00:00
imprv: Loosen matching rules for URL query strings

- - - - -


2 changed files:

- gajim/common/regex.py
- test/common/test_styling.py


Changes:

=====================================
gajim/common/regex.py
=====================================
@@ -33,7 +33,10 @@
     r'\U000F0000-\U000FFFFD\U00100000-\U0010FFFD'
 unreserved     = r'A-Za-z0-9\-._~'
 iunreserved    = fr'{unreserved}{ucschar}'
+urlchar = r"A-Za-z0-9\-._~:/?#\[\]@!$&'()*+,;="
+pct_loose = fr'%[{urlchar}]'
 pct_encoded    = fr'%{HEXDIG}{HEXDIG}'
+ipchar_loose   = fr'(?:[{iunreserved}{sub_delims}:@]|{pct_loose})'
 ipchar         = fr'(?:[{iunreserved}{sub_delims}:@]|{pct_encoded})'
 iuserinfo      = fr'(?:[{iunreserved}{sub_delims}:]|{pct_encoded})*'
 ireg_name      = fr'(?:[{iunreserved}{sub_delims}]|{pct_encoded})*'
@@ -75,7 +78,7 @@
                  fr'|{ipath_absolute}'\
                  fr'|{ipath_rootless}'\
                  fr'|{ipath_empty})'
-iquery         = fr'(?:{ipchar}|[/?{iprivate}])*'
+iquery         = fr'(?:{ipchar_loose}|[/?{iprivate}])*'
 ifragment      = fr'(?:{ipchar}|[/?])*'
 scheme         = fr'(?P<scheme>{ALPHA}[a-zA-Z0-9+.-]*)'
 IRI            = fr'{scheme}:{ihier_part}(?:\?{iquery})?(?:#{ifragment})?'


=====================================
test/common/test_styling.py
=====================================
@@ -319,6 +319,7 @@
     'http://foo.com/blah_blah_(wikipedia)_(again)',
     'http://www.example.com/wpstyle/?p=364',
     'https://www.example.com/foo/?bar=baz&inga=42&quux',
+    'https://www.example.com?foo=%s',
     'http://✪df.ws/123',
     'http://userid:[email protected]:8080',
     'http://userid:[email protected]:8080/',



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/404d221d780251a8d478b42136e8a997ae8295f9

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/404d221d780251a8d478b42136e8a997ae8295f9
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to