Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix thumbnail_img NoneType error (#2941)

wwwlll6a4858a7ee5e
diff --git a/api/utils/file_utils.py b/api/utils/file_utils.py
index 2428f3f21e..32ead6cc70 100644
--- a/api/utils/file_utils.py
+++ b/api/utils/file_utils.py
@@ -199,8 +199,11 @@ def thumbnail_img(filename, blob):
def thumbnail(filename, blob):
img = thumbnail_img(filename, blob)
- return IMG_BASE64_PREFIX + \
- base64.b64encode(img).decode("utf-8")
+ if img is not None:
+ return IMG_BASE64_PREFIX + \
+ base64.b64encode(img).decode("utf-8")
+ else:
+ return ''
def traversal_files(base):
for root, ds, fs in os.walk(base):