mirror of
https://github.com/LC044/WeChatMsg
synced 2025-05-24 17:29:43 +08:00
fix: 修复文件名中有单引号导致导出html不显示所有聊天记录的问题
This commit is contained in:
parent
cd08bf3862
commit
9a8c85faf0
@ -16,6 +16,7 @@ from app.util.compress_content import parser_reply, share_card, music_share, fil
|
|||||||
from app.util.emoji import get_emoji_url
|
from app.util.emoji import get_emoji_url
|
||||||
from app.util.image import get_image_path, get_image
|
from app.util.image import get_image_path, get_image
|
||||||
from app.util.music import get_music_path
|
from app.util.music import get_music_path
|
||||||
|
from app.util.file import escape_single_quotes
|
||||||
|
|
||||||
|
|
||||||
icon_files = {
|
icon_files = {
|
||||||
@ -127,10 +128,12 @@ class HtmlExporter(ExporterBase):
|
|||||||
file_path = file_info.get('file_path')
|
file_path = file_info.get('file_path')
|
||||||
if file_path != "":
|
if file_path != "":
|
||||||
file_path = './file/' + file_info.get('file_name')
|
file_path = './file/' + file_info.get('file_name')
|
||||||
|
file_path = escape_single_quotes(file_path)
|
||||||
|
file_name = escape_single_quotes(file_info.get('file_name'))
|
||||||
doc.write(
|
doc.write(
|
||||||
f'''{{ type:49, text: '{file_path}',is_send:{is_send},avatar_path:'{avatar}',timestamp:{timestamp}
|
f'''{{ type:49, text: '{file_path}',is_send:{is_send},avatar_path:'{avatar}',timestamp:{timestamp}
|
||||||
,is_chatroom:{is_chatroom},displayname:'{display_name}',icon_path: '{icon_path}'
|
,is_chatroom:{is_chatroom},displayname:'{display_name}',icon_path: '{icon_path}'
|
||||||
,sub_type:6,file_name: '{file_info.get('file_name')}',file_size: '{file_info.get('file_len')}'
|
,sub_type:6,file_name: '{file_name}',file_size: '{file_info.get('file_len')}'
|
||||||
,app_name: '{file_info.get('app_name')}'}},'''
|
,app_name: '{file_info.get('app_name')}'}},'''
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -57,3 +57,6 @@ def get_file(bytes_extra, file_name, output_path=root_path) -> str:
|
|||||||
except:
|
except:
|
||||||
logger.error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
def escape_single_quotes(path_str:str) -> str:
|
||||||
|
return path_str.replace("'",r"\'")
|
Loading…
Reference in New Issue
Block a user