Guard missing storage blobs on preview and image endpoints (#15366)

Fixes [#15365](https://github.com/infiniflow/ragflow/issues/15365) —
`get_document_image()` and document preview call `make_response(None)`
when storage returns no bytes, causing HTTP 500.
This commit is contained in:
kpdev
2026-06-02 20:33:03 -07:00
committed by GitHub
parent ff5971448b
commit 76968af0ba
2 changed files with 20 additions and 0 deletions

View File

@@ -1924,6 +1924,8 @@ async def get(doc_id):
b, n = File2DocumentService.get_storage_address(doc_id=doc_id)
data = await thread_pool_exec(settings.STORAGE_IMPL.get, b, n)
if not data:
return get_data_error_result(message="This file is empty.")
response = await make_response(data)
ext = re.search(r"\.([^.]+)$", doc.name.lower())