plugin URI finder: make the regex ignore case.

This commit is contained in:
Goffi 2024-11-20 15:29:47 +01:00
commit e161ff2d57

View file

@ -74,11 +74,12 @@ class URIFinder(object):
@return (dict[unicode, unicode]): map from key to found uri
"""
keys_re = "|".join(keys)
label_re = r'"(?P<label>[^"]+)"'
label_re = r'\"(?P<label>[^\"]+)\"'
uri_re = re.compile(
r"(?P<key>{keys_re})[ :]? +(?P<uri>xmpp:\S+)(?:.*use {label_re} label)?".format(
keys_re=keys_re, label_re=label_re
)
),
re.IGNORECASE
)
path = os.path.normpath(path)
if not os.path.isdir(path) or not os.path.isabs(path):
@ -92,7 +93,7 @@ class URIFinder(object):
file_path = os.path.join(path, filename)
with open(file_path) as f:
for m in uri_re.finditer(f.read()):
key = m.group("key")
key = m.group("key").lower()
uri = m.group("uri")
label = m.group("label")
if key in found_uris: