修复导出图片缺失的问题

This commit is contained in:
shuaikangzhou 2023-12-07 00:19:16 +08:00
parent 4d1d1a631d
commit db0277fbd7
2 changed files with 5 additions and 4 deletions

View File

@ -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):

View File

@ -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