From 5d5ab76f70898de8d4166460acd8c3df408f63b7 Mon Sep 17 00:00:00 2001 From: xaoyaoo Date: Tue, 2 Jan 2024 13:22:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=A0=E6=B3=95=E6=AD=A3?= =?UTF-8?q?=E5=B8=B8=E6=98=BE=E7=A4=BA=E5=9B=BE=E7=89=87=E5=B9=B6=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pywxdump/ui/view_chat.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pywxdump/ui/view_chat.py b/pywxdump/ui/view_chat.py index dc56a4f0..e6031071 100644 --- a/pywxdump/ui/view_chat.py +++ b/pywxdump/ui/view_chat.py @@ -183,9 +183,12 @@ def load_chat_records(selected_talker, start_index, page_size, user_list, MSG_AL img_path = os.path.join(*img_path) if FileStorage_path: img_path = os.path.join(FileStorage_path, img_path) - fomt, md5, out_bytes = read_img_dat(img_path) - out_bytes = base64.b64encode(out_bytes).decode("utf-8") - content["src"] = f"data:{fomt};base64,{out_bytes}" + if os.path.exists(img_path): + fomt, md5, out_bytes = read_img_dat(img_path) + out_bytes = base64.b64encode(out_bytes).decode("utf-8") + content["src"] = f"data:{fomt};base64,{out_bytes}" + else: + content["src"] = "" else: content["src"] = "" else: