From c0a69fc89112bbb8a56de0306d3b1ac79567d205 Mon Sep 17 00:00:00 2001 From: Wenjie Zhang Date: Thu, 2 Oct 2025 19:59:16 +0800 Subject: [PATCH] =?UTF-8?q?fix(router):=20=E4=BF=AE=E5=A4=8D=E7=9F=A5?= =?UTF-8?q?=E8=AF=86=E5=BA=93=E8=B7=AF=E7=94=B1=E4=B8=AD=E7=9A=84=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E8=B7=AF=E5=BE=84=E5=AF=BC=E5=85=A5=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=20#284?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 更新知识库路由中的文件路径验证导入路径,确保从正确的模块导入 validate_file_path 函数 - 维护代码一致性,提升可读性 --- server/routers/knowledge_router.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/routers/knowledge_router.py b/server/routers/knowledge_router.py index 6b4d6c64..b8d69fee 100644 --- a/server/routers/knowledge_router.py +++ b/server/routers/knowledge_router.py @@ -152,7 +152,7 @@ async def add_documents( # 安全检查:验证文件路径 if content_type == "file": - from src.knowledge.kb_utils import validate_file_path + from src.knowledge.utils.kb_utils import validate_file_path for item in items: try: @@ -236,7 +236,7 @@ async def download_document(db_id: str, doc_id: str, request: Request, current_u raise HTTPException(status_code=404, detail="File path not found in metadata") # 安全检查:验证文件路径 - from src.knowledge.kb_utils import validate_file_path + from src.knowledge.utils.kb_utils import validate_file_path try: normalized_path = validate_file_path(file_path, db_id)