fix(light): 从脚本数据中排除_id字段

避免将MongoDB的内部_id字段暴露给前端,确保数据安全性
This commit is contained in:
2025-12-16 14:39:08 +08:00
parent 81692b1676
commit 3b37e13833

View File

@@ -88,8 +88,8 @@ async def get_user_scripts_with_answers(user_id: str):
# 构建结果数据 # 构建结果数据
result = [] result = []
for script in scripts: for script in scripts:
# 复制脚本数据 # 复制脚本数据但排除_id字段
script_data = script.copy() script_data = {key: value for key, value in script.items() if key != "_id"}
# 获取该脚本的code # 获取该脚本的code
code = script_data.get("code") code = script_data.get("code")