From 3e6fdaa1268063382ad1362a38652892df2452a6 Mon Sep 17 00:00:00 2001 From: KnugiHK <24708955+KnugiHK@users.noreply.github.com> Date: Sun, 15 Sep 2024 11:09:06 +0800 Subject: [PATCH] Bug fix on empty file name for (mostly) ios --- Whatsapp_Chat_Exporter/utility.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Whatsapp_Chat_Exporter/utility.py b/Whatsapp_Chat_Exporter/utility.py index 0ece1ee..8c4fc95 100644 --- a/Whatsapp_Chat_Exporter/utility.py +++ b/Whatsapp_Chat_Exporter/utility.py @@ -202,7 +202,7 @@ def get_file_name(contact: str, chat: ChatStore): if "@" not in contact and contact not in ("000000000000000", "000000000000001", "ExportedChat"): raise ValueError("Unexpected contact format: " + contact) phone_number = contact.split('@')[0] - if "-" in contact: + if "-" in contact and chat.name is not None: file_name = "" else: file_name = phone_number @@ -210,7 +210,7 @@ def get_file_name(contact: str, chat: ChatStore): if chat.name is not None: if file_name != "": file_name += "-" - file_name += chat.name.replace("/", "-") + file_name += chat.name.replace("/", "-").replace("\\", "-") name = chat.name else: name = phone_number