changeset 4331:e0ae6ca806ba

plugin URI finder: make the regex ignore case.
author Goffi <goffi@goffi.org>
date Wed, 20 Nov 2024 15:29:47 +0100 (3 weeks ago)
parents cb32d8c6a040
children 71c939e34ca6
files libervia/backend/plugins/plugin_misc_uri_finder.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libervia/backend/plugins/plugin_misc_uri_finder.py	Wed Nov 20 15:29:16 2024 +0100
+++ b/libervia/backend/plugins/plugin_misc_uri_finder.py	Wed Nov 20 15:29:47 2024 +0100
@@ -74,11 +74,12 @@
         @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 @@
                     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: