chore: update file query to include document_id in filter

--bug=1062912 --user=刘瑞斌 【知识库】文档-替换原文档成功,但是下载原文档依然是替换前的文档 https://www.tapd.cn/62980211/s/1789094
This commit is contained in:
CaptainB 2025-10-23 11:43:13 +08:00
parent 1070d27d2a
commit a584378002

View File

@ -1548,7 +1548,8 @@ class DocumentSerializers(serializers.Serializer):
# 查找所有具有相同sha256_hash的文件
files_to_update = QuerySet(File).filter(
Q(sha256_hash=original_hash) & Q(source_id=self.data.get('knowledge_id'))
sha256_hash=original_hash,
source_id__in=[self.data.get('knowledge_id'), self.data.get('document_id')]
)
# 更新所有相同hash的文件