RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
Fix: close detached PIL image on JPEG save failure in encode_image (#13278)
Yongteng Leic91e803a383c
diff --git a/rag/utils/base64_image.py b/rag/utils/base64_image.pyindex 5a328dd3ea..bc73c0433f 100644--- a/rag/utils/base64_image.py+++ b/rag/utils/base64_image.py@@ -64,17 +64,17 @@ async def image2id(d: dict, storage_put_func: partial, objname: str, bucket: strtry:img.save(buf, format="JPEG")+ buf.seek(0)+ return buf.getvalue()except OSError as e:logging.warning(f"Saving image exception: {e}")return None-- buf.seek(0)- if close_after:- try:- img.close()- except Exception:- pass- return buf.getvalue()+ finally:+ if close_after:+ try:+ img.close()+ except Exception:+ passjpeg_binary = await thread_pool_exec(encode_image)if jpeg_binary is None: