From 5c4dc84bad1206fddc25aa793022e91a4148932c Mon Sep 17 00:00:00 2001 From: Raffael Meyer <14891507+barredterra@users.noreply.github.com> Date: Wed, 4 Dec 2024 16:16:42 +0100 Subject: [PATCH] fix: handle empty images (#28669) Resolves #28668 --- frappe/core/doctype/file/utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frappe/core/doctype/file/utils.py b/frappe/core/doctype/file/utils.py index 3286704466..b87671b171 100644 --- a/frappe/core/doctype/file/utils.py +++ b/frappe/core/doctype/file/utils.py @@ -238,6 +238,10 @@ def extract_images_from_html(doc: "Document", content: str, is_private: bool = F if b"," in content: content = content.split(b",")[1] + if not content: + # if there is no content, return the original tag + return match.group(0) + try: content = safe_b64decode(content) except BinasciiError: