Skip to content

Commit c758b2d

Browse files
authored
feat: use shell globbing to match umop config router (#4270)
* feat: use shell globbing to match umop config router * rf * fix: use fnmatchcase for case-sensitive matching in UmopConfigRouter
1 parent 510290f commit c758b2d

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

astrbot/core/umop_config_router.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import fnmatch
2+
13
from astrbot.core.utils.shared_preferences import SharedPreferences
24

35

@@ -30,7 +32,7 @@ def _is_umo_match(self, p1: str, p2: str) -> bool:
3032
if len(p1_ls) != 3 or len(p2_ls) != 3:
3133
return False # 非法格式
3234

33-
return all(p == "" or p == "*" or p == t for p, t in zip(p1_ls, p2_ls))
35+
return all(p == "" or fnmatch.fnmatchcase(t, p) for p, t in zip(p1_ls, p2_ls))
3436

3537
def get_conf_id_for_umop(self, umo: str) -> str | None:
3638
"""根据 UMO 获取对应的配置文件 ID

0 commit comments

Comments
 (0)