fix: preserve empty dict allow_from handling

Keep dict-backed channel configs compatible with both allow_from and allowFrom without losing empty-list semantics, and add focused regression coverage for the allow-list boundary.

Made-with: Cursor
This commit is contained in:
Xubin Ren
2026-04-15 01:26:51 +08:00
committed by Xubin Ren
parent 73cf9a220b
commit 1f33df1ea6
4 changed files with 43 additions and 3 deletions
+4 -1
View File
@@ -77,7 +77,10 @@ class ChannelManager:
for name, ch in self.channels.items():
cfg = ch.config
if isinstance(cfg, dict):
allow = cfg.get("allow_from") or cfg.get("allowFrom")
if "allow_from" in cfg:
allow = cfg.get("allow_from")
else:
allow = cfg.get("allowFrom")
else:
allow = getattr(cfg, "allow_from", None)
if allow == []: