From 3b37e138335eceac37184ee614a19c3019f1f7d9 Mon Sep 17 00:00:00 2001 From: chenpanliang <3245129380@qq.com> Date: Tue, 16 Dec 2025 14:39:08 +0800 Subject: [PATCH] =?UTF-8?q?fix(light):=20=E4=BB=8E=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=B8=AD=E6=8E=92=E9=99=A4=5Fid=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 避免将MongoDB的内部_id字段暴露给前端,确保数据安全性 --- src/routers/light.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routers/light.py b/src/routers/light.py index f372798..d0ef893 100644 --- a/src/routers/light.py +++ b/src/routers/light.py @@ -88,8 +88,8 @@ async def get_user_scripts_with_answers(user_id: str): # 构建结果数据 result = [] for script in scripts: - # 复制脚本数据 - script_data = script.copy() + # 复制脚本数据,但排除_id字段 + script_data = {key: value for key, value in script.items() if key != "_id"} # 获取该脚本的code code = script_data.get("code")