From 637c79de64109b7579f6fe1cc81690b975000975 Mon Sep 17 00:00:00 2001 From: Yue Fei Date: Mon, 20 Jan 2025 19:05:14 +0800 Subject: [PATCH] Fix image-path validation in ImageNode (#17558) * fix image path validation * Update llama-index-core/llama_index/core/schema.py Co-authored-by: Massimiliano Pippi --------- Co-authored-by: Massimiliano Pippi --- llama-index-core/llama_index/core/schema.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llama-index-core/llama_index/core/schema.py b/llama-index-core/llama_index/core/schema.py index 5b3c1d9302a3d..9ef8b58fe6c59 100644 --- a/llama-index-core/llama_index/core/schema.py +++ b/llama-index-core/llama_index/core/schema.py @@ -794,7 +794,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: kwargs["image_mimetype"] = ir.get("mimetype", None) mimetype = kwargs.get("image_mimetype") - if not mimetype and "image_path" in kwargs: + if not mimetype and kwargs.get("image_path") is not None: # guess mimetype from image_path extension = Path(kwargs["image_path"]).suffix.replace(".", "") if ftype := filetype.get_type(ext=extension):