fix(knowledge): 文档上传失败时清理存储文件 - #96
Open
KDB-Wind wants to merge 1 commit into
Open
Conversation
KDB-Wind
force-pushed
the
codex/fix-upload-orphan-file
branch
from
August 1, 2026 11:11
1102344 to
d9ee046
Compare
对象写入成功后,文档插入异常或返回 0 会留下没有数据库记录的文件。插入失败时按已生成 ID 复核记录,仅在确认不存在时删除;无法确认提交结果或清理失败时保留原异常。
KDB-Wind
force-pushed
the
codex/fix-upload-orphan-file
branch
from
August 3, 2026 13:34
d9ee046 to
118c40a
Compare
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.
Fixes #94
问题
当前
main已在写入对象存储前完成处理模式校验。对象写入成功后,如果文档插入抛出异常或返回0,上传对象仍可能没有对应的文档记录。修改
<= 0视为失败上传成功路径和已有的不支持 MIME 类型清理逻辑不变。
测试
KnowledgeDocumentServiceImplUploadTest覆盖 FILE、URL 配置错误,以及插入失败、结果不明确、清理失败、正常上传和不支持的文件类型。连接中断或超时时,数据库提交状态仍可能不明确。本次只提供 best-effort 补偿,不处理历史孤儿对象,也不引入分布式事务。