Conversation
…ALID (TencentCloud#909) Path validation ValueErrors from normalize_kb_path/ensure_folder (e.g. '..' segments, empty/root paths) fell through to the unhandled-error branch and returned 500 with a stack trace. These are caller input errors, so map them to a new 400 error code KNOWLEDGE_PATH_INVALID with en/zh messages.
Jay0130-a
force-pushed
the
fix/knowledge-path-400-909
branch
from
September 23, 2026 15:12
918d42c to
095cfa7
Compare
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
Closes #909。
POST /api/knowledge-bases/{kb_id}/folders等接口对调用方传入的非法路径(含..、空/根目录如.、/)返回 500INTERNAL_ERROR并打堆栈,应为 400。改动
KNOWLEDGE_PATH_INVALID(HTTP 400),补 en/zh 文案。_map_knowledge_error将invalid knowledge document path/invalid knowledge folder path映射到新错误码,不再落兜底分支。测试计划
ruff check/ruff format干净。