Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: document delete image files check file exist (#21991)

quicksand5b0b64c7e5ca
diff --git a/api/core/indexing_runner.py b/api/core/indexing_runner.py
index f2fe3061796..305a9190d5c 100644
--- a/api/core/indexing_runner.py
+++ b/api/core/indexing_runner.py
@@ -317,9 +317,10 @@ class IndexingRunner:
image_upload_file_ids = get_image_upload_file_ids(document.page_content)
for upload_file_id in image_upload_file_ids:
image_file = db.session.query(UploadFile).filter(UploadFile.id == upload_file_id).first()
+ if image_file is None:
+ continue
try:
- if image_file:
- storage.delete(image_file.key)
+ storage.delete(image_file.key)
except Exception:
logging.exception(
"Delete image_files failed while indexing_estimate, \