Bug fix on empty file name for (mostly) ios

This commit is contained in:
KnugiHK
2024-09-15 11:09:06 +08:00
parent 04000c78e2
commit 3e6fdaa126

View File

@@ -202,7 +202,7 @@ def get_file_name(contact: str, chat: ChatStore):
if "@" not in contact and contact not in ("000000000000000", "000000000000001", "ExportedChat"): if "@" not in contact and contact not in ("000000000000000", "000000000000001", "ExportedChat"):
raise ValueError("Unexpected contact format: " + contact) raise ValueError("Unexpected contact format: " + contact)
phone_number = contact.split('@')[0] phone_number = contact.split('@')[0]
if "-" in contact: if "-" in contact and chat.name is not None:
file_name = "" file_name = ""
else: else:
file_name = phone_number file_name = phone_number
@@ -210,7 +210,7 @@ def get_file_name(contact: str, chat: ChatStore):
if chat.name is not None: if chat.name is not None:
if file_name != "": if file_name != "":
file_name += "-" file_name += "-"
file_name += chat.name.replace("/", "-") file_name += chat.name.replace("/", "-").replace("\\", "-")
name = chat.name name = chat.name
else: else:
name = phone_number name = phone_number