fix(platforms): extra_or_secret keeps blank-string YAML values where the old readers did
dingtalk _extra_get, mattermost _extra_or_env and slack _extra_or_env_flag/_channel_set fell through to env only on None, so `allowed_channels: ""` / `free_response_channels: ""` meant "no whitelist" rather than "use the env CSV". The shared reader treated blank as unset and silently widened those to the env value. New `blank_is_unset=False` knob restores the old semantics at those seven call sites; the default (blank = unset) stays for the readers whose old body was `extra.get(k) or env`.
This commit is contained in:
@@ -5963,7 +5963,7 @@ class SlackAdapter(BasePlatformAdapter):
|
||||
|
||||
def _extra_or_env_flag(self, key: str, env_var: str, *, strip: bool = False) -> bool:
|
||||
"""Opt-in boolean: ``config.extra[key]`` wins, else ``env_var`` (default false)."""
|
||||
configured = _extra_or_secret(self.config.extra, key, env_var, "false")
|
||||
configured = _extra_or_secret(self.config.extra, key, env_var, "false", blank_is_unset=False)
|
||||
if isinstance(configured, str):
|
||||
if strip:
|
||||
configured = configured.strip()
|
||||
@@ -5997,7 +5997,7 @@ class SlackAdapter(BasePlatformAdapter):
|
||||
self, key: str, env_var: str, *, coerce_scalar: bool = False) -> set:
|
||||
"""Channel-ID set from ``config.extra[key]`` (list or CSV) else ``env_var`` CSV.
|
||||
``coerce_scalar`` accepts non-str scalars (a bare numeric YAML value loads as int)."""
|
||||
raw = _extra_or_secret(self.config.extra, key, env_var, "")
|
||||
raw = _extra_or_secret(self.config.extra, key, env_var, "", blank_is_unset=False)
|
||||
if isinstance(raw, list):
|
||||
return {str(part).strip() for part in raw if str(part).strip()}
|
||||
if coerce_scalar:
|
||||
|
||||
Reference in New Issue
Block a user