mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-01-24 16:24:15 +03:00
Fix bug with semicolons when downloading contacts (#319)
This commit is contained in:
parent
39a1d5e90d
commit
af08d59cb7
|
@ -51,7 +51,6 @@ from .tl.types import (
|
||||||
PeerUser, InputPeerUser, InputPeerChat, InputPeerChannel)
|
PeerUser, InputPeerUser, InputPeerChat, InputPeerChannel)
|
||||||
from .tl.types.messages import DialogsSlice
|
from .tl.types.messages import DialogsSlice
|
||||||
|
|
||||||
|
|
||||||
class TelegramClient(TelegramBareClient):
|
class TelegramClient(TelegramBareClient):
|
||||||
"""Full featured TelegramClient meant to extend the basic functionality -
|
"""Full featured TelegramClient meant to extend the basic functionality -
|
||||||
|
|
||||||
|
@ -821,12 +820,18 @@ class TelegramClient(TelegramBareClient):
|
||||||
f = file
|
f = file
|
||||||
|
|
||||||
try:
|
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('BEGIN:VCARD\n')
|
||||||
f.write('VERSION:4.0\n')
|
f.write('VERSION:4.0\n')
|
||||||
f.write('N:{};{};;;\n'.format(
|
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(
|
f.write('TEL;TYPE=cell;VALUE=uri:tel:+{}\n'.format(
|
||||||
phone_number))
|
phone_number))
|
||||||
f.write('END:VCARD\n')
|
f.write('END:VCARD\n')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user