fix: document delete image files check file exist (#21991)
This commit is contained in:
parent
b654c852a5
commit
5b0b64c7e5
1 changed files with 3 additions and 2 deletions
|
|
@ -317,9 +317,10 @@ class IndexingRunner:
|
||||||
image_upload_file_ids = get_image_upload_file_ids(document.page_content)
|
image_upload_file_ids = get_image_upload_file_ids(document.page_content)
|
||||||
for upload_file_id in image_upload_file_ids:
|
for upload_file_id in image_upload_file_ids:
|
||||||
image_file = db.session.query(UploadFile).filter(UploadFile.id == upload_file_id).first()
|
image_file = db.session.query(UploadFile).filter(UploadFile.id == upload_file_id).first()
|
||||||
|
if image_file is None:
|
||||||
|
continue
|
||||||
try:
|
try:
|
||||||
if image_file:
|
storage.delete(image_file.key)
|
||||||
storage.delete(image_file.key)
|
|
||||||
except Exception:
|
except Exception:
|
||||||
logging.exception(
|
logging.exception(
|
||||||
"Delete image_files failed while indexing_estimate, \
|
"Delete image_files failed while indexing_estimate, \
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue