diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..35410ca
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# 默认忽略的文件
+/shelf/
+/workspace.xml
+# 基于编辑器的 HTTP 客户端请求
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/FixClassworksKV.iml b/.idea/FixClassworksKV.iml
new file mode 100644
index 0000000..24643cc
--- /dev/null
+++ b/.idea/FixClassworksKV.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..09fff6f
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/routes/kv-token.js b/routes/kv-token.js
index 8090577..0c0af6e 100644
--- a/routes/kv-token.js
+++ b/routes/kv-token.js
@@ -356,7 +356,10 @@ router.post(
const {key} = req.params;
const value = req.body;
- if (!value || Object.keys(value).length === 0) {
+ // 【修改点】允许空数组通过校验,但继续拦截真正的空对象 {}
+ // 如果 value 是空数组 [],Object.keys 为 0,但 !Array.isArray 为 false,条件为 false -> 通过
+ // 如果 value 是空对象 {},Object.keys 为 0,且 !Array.isArray 为 true,条件为 true -> 拦截
+ if (!value || (Object.keys(value).length === 0 && !Array.isArray(value))) {
return next(errors.createError(400, "请提供有效的JSON值"));
}
@@ -429,4 +432,4 @@ router.delete(
})
);
-export default router;
\ No newline at end of file
+export default router;v
\ No newline at end of file