Skip to content

Commit

Permalink
修复无法正常显示图片并报错的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
xaoyaoo committed Jan 2, 2024
1 parent 401e42c commit 5d5ab76
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pywxdump/ui/view_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 5d5ab76

Please sign in to comment.