Fix bug with semicolons when downloading contacts (#319)

This commit is contained in:
Tanuj 2017-10-28 10:09:46 +01:00 committed by Lonami
parent 39a1d5e90d
commit af08d59cb7

View File

@ -51,7 +51,6 @@ from .tl.types import (
PeerUser, InputPeerUser, InputPeerChat, InputPeerChannel)
from .tl.types.messages import DialogsSlice
class TelegramClient(TelegramBareClient):
"""Full featured TelegramClient meant to extend the basic functionality -
@ -821,12 +820,18 @@ class TelegramClient(TelegramBareClient):
f = file
try:
# Remove these pesky characters
first_name = first_name.replace(';','')
if last_name is None:
last_name = ''
else:
last_name = last_name.replace(';','')
f.write('BEGIN:VCARD\n')
f.write('VERSION:4.0\n')
f.write('N:{};{};;;\n'.format(
first_name, last_name if last_name else '')
first_name, last_name)
)
f.write('FN:{}\n'.format(' '.join((first_name, last_name))))
f.write('FN:{} {}\n'.format(first_name, last_name)
f.write('TEL;TYPE=cell;VALUE=uri:tel:+{}\n'.format(
phone_number))
f.write('END:VCARD\n')