mirror of
https://github.com/open-webui/open-webui.git
synced 2026-11-14 09:21:22 +00:00
fix: ignore empty Feishu env aliases
This commit is contained in:
parent
540e37a04a
commit
cc503d2528
2 changed files with 35 additions and 1 deletions
|
|
@ -31,6 +31,40 @@ def test_get_env_with_aliases_falls_back_to_legacy_alias():
|
|||
)
|
||||
|
||||
|
||||
def test_get_env_with_aliases_skips_empty_documented_env_name():
|
||||
environ = {
|
||||
'FEISHU_CLIENT_SCOPE': '',
|
||||
'FEISHU_OAUTH_SCOPE': 'contact:user.email:readonly',
|
||||
}
|
||||
|
||||
assert (
|
||||
get_env_with_aliases(
|
||||
'FEISHU_CLIENT_SCOPE',
|
||||
'FEISHU_OAUTH_SCOPE',
|
||||
default='contact:user.base:readonly',
|
||||
environ=environ,
|
||||
)
|
||||
== 'contact:user.email:readonly'
|
||||
)
|
||||
|
||||
|
||||
def test_get_env_with_aliases_skips_empty_aliases_before_default():
|
||||
environ = {
|
||||
'FEISHU_CLIENT_SCOPE': '',
|
||||
'FEISHU_OAUTH_SCOPE': '',
|
||||
}
|
||||
|
||||
assert (
|
||||
get_env_with_aliases(
|
||||
'FEISHU_CLIENT_SCOPE',
|
||||
'FEISHU_OAUTH_SCOPE',
|
||||
default='contact:user.base:readonly',
|
||||
environ=environ,
|
||||
)
|
||||
== 'contact:user.base:readonly'
|
||||
)
|
||||
|
||||
|
||||
def test_get_env_with_aliases_returns_default_when_missing():
|
||||
assert (
|
||||
get_env_with_aliases(
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ def get_env_with_aliases(
|
|||
|
||||
for name in (env_name, *aliases):
|
||||
value = values.get(name)
|
||||
if value is not None:
|
||||
if value is not None and value != '':
|
||||
return value
|
||||
|
||||
return default
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue