From db0277fbd7b398ca09af63d92c61b066dc8b0095 Mon Sep 17 00:00:00 2001 From: shuaikangzhou <863909694@qq.com> Date: Thu, 7 Dec 2023 00:19:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AF=BC=E5=87=BA=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E7=BC=BA=E5=A4=B1=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/DataBase/output_pc.py | 2 +- app/util/dat2pic.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/DataBase/output_pc.py b/app/DataBase/output_pc.py index 77f0adf..76dc719 100644 --- a/app/DataBase/output_pc.py +++ b/app/DataBase/output_pc.py @@ -890,7 +890,7 @@ const chatMessages = [ if match: continue image_path = hard_link_db.get_image(content=str_content, thumb=False) - image_path = path.get_relative_path(image_path, base_path=f'./data/聊天记录/{self.contact.remark}/image') + image_path = path.get_relative_path(image_path, base_path=f'/data/聊天记录/{self.contact.remark}/image') image_path = image_path.replace('\\', '/') # print(f"tohtml:---{image_path}") if self.is_5_min(timestamp): diff --git a/app/util/dat2pic.py b/app/util/dat2pic.py index 9c7df78..7a36d9c 100644 --- a/app/util/dat2pic.py +++ b/app/util/dat2pic.py @@ -50,14 +50,15 @@ def decode_dat(file_path, out_path): if decode_code == -1: return + filename = os.path.basename(file_path) if file_type == 1: pic_name = os.path.basename(file_path)[:-4] + ".jpg" elif file_type == 3: - pic_name = file_path[:-4] + ".png" + pic_name = filename[:-4] + ".png" elif file_type == 5: - pic_name = file_path[:-4] + ".gif" + pic_name = filename[:-4] + ".gif" else: - pic_name = file_path[:-4] + ".jpg" + pic_name = filename[:-4] + ".jpg" file_outpath = os.path.join(out_path, pic_name) if os.path.exists(file_outpath): return file_outpath