From 2cd03e50784f999ac0db009f008894a6c25ad738 Mon Sep 17 00:00:00 2001 From: xaoyaoo Date: Thu, 21 Dec 2023 21:00:05 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E7=BD=AEFileStorage=5Fpath=E4=B8=BA?= =?UTF-8?q?=E9=9D=9E=E5=BF=85=E9=A1=BB=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pywxdump/ui/view_chat.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/pywxdump/ui/view_chat.py b/pywxdump/ui/view_chat.py index e769d72..fb4ec2d 100644 --- a/pywxdump/ui/view_chat.py +++ b/pywxdump/ui/view_chat.py @@ -176,12 +176,15 @@ def load_chat_records(selected_talker, start_index, page_size, user_list, MSG_AL match = re.search(r"MsgAttach(.*?)'", BytesExtra) if match: img_path = match.group(0).replace("'", "") - print(FileStorage_path) - print(img_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}" + # print(FileStorage_path) + # print(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}" + else: + content["src"] = "" else: content["src"] = "" content["msg"] = "图片"