fix: prevent account_settings KV.put on empty fromBlockList (#847)

* fix: avoid KV.put when fromBlockList is empty

* docs: update English changelog for account_settings fix
This commit is contained in:
Dream Hunter
2026-03-02 00:27:24 +08:00
committed by GitHub
parent 0df74ee5cc
commit a5e5fceab5
3 changed files with 4 additions and 2 deletions

View File

@@ -322,8 +322,8 @@ api.post('/admin/account_settings', async (c) => {
if (fromBlockList?.length > 0 && !c.env.KV) {
return c.text(msgs.EnableKVMsg, 400)
}
if (fromBlockList) {
await c.env.KV.put(CONSTANTS.EMAIL_KV_BLACK_LIST, JSON.stringify(fromBlockList || []))
if (fromBlockList?.length > 0 && c.env.KV) {
await c.env.KV.put(CONSTANTS.EMAIL_KV_BLACK_LIST, JSON.stringify(fromBlockList))
}
await saveSetting(
c, CONSTANTS.NO_LIMIT_SEND_ADDRESS_LIST_KEY,