fix(router): 修复知识库路由中的文件路径导入路径 #284
- 更新知识库路由中的文件路径验证导入路径,确保从正确的模块导入 validate_file_path 函数 - 维护代码一致性,提升可读性
This commit is contained in:
parent
2112d4833d
commit
c0a69fc891
@ -152,7 +152,7 @@ async def add_documents(
|
|||||||
|
|
||||||
# 安全检查:验证文件路径
|
# 安全检查:验证文件路径
|
||||||
if content_type == "file":
|
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:
|
for item in items:
|
||||||
try:
|
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")
|
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:
|
try:
|
||||||
normalized_path = validate_file_path(file_path, db_id)
|
normalized_path = validate_file_path(file_path, db_id)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user