Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

storage: Fix get_storage and remove_storage with empty keys list.

Anders Kaseorg9a2140d60ef8
diff --git a/zerver/views/storage.py b/zerver/views/storage.py
index fbbf6c5a8c5..18c9dc72a2f 100644
--- a/zerver/views/storage.py
+++ b/zerver/views/storage.py
@@ -34,7 +34,8 @@ def get_storage(
user_profile: UserProfile,
keys: Optional[List[str]] = REQ(json_validator=check_list(check_string), default=None),
) -> HttpResponse:
- keys = keys or get_keys_in_bot_storage(user_profile)
+ if keys is None:
+ keys = get_keys_in_bot_storage(user_profile)
try:
storage = {key: get_bot_storage(user_profile, key) for key in keys}
except StateError as e:
@@ -48,7 +49,8 @@ def remove_storage(
user_profile: UserProfile,
keys: Optional[List[str]] = REQ(json_validator=check_list(check_string), default=None),
) -> HttpResponse:
- keys = keys or get_keys_in_bot_storage(user_profile)
+ if keys is None:
+ keys = get_keys_in_bot_storage(user_profile)
try:
remove_bot_storage(user_profile, keys)
except StateError as e: