diff libervia/backend/plugins/plugin_misc_uri_finder.py @ 4331:e0ae6ca806ba

plugin URI finder: make the regex ignore case.
author Goffi <goffi@goffi.org>
date Wed, 20 Nov 2024 15:29:47 +0100
parents 0d7bb4df2343
children 111dce64dcb5
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: