Fixes file downloading error

`date`'s default value is `None`, so this function will crash if `name` is empty and `date` is not provided
This commit is contained in:
Birger Jarl 2017-11-29 05:00:40 +03:00 committed by GitHub
parent 605c103f29
commit 01c8bf2589
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -967,6 +967,8 @@ class TelegramClient(TelegramBareClient):
name = None
if not name:
if not date:
date = datetime.now()
name = '{}_{}-{:02}-{:02}_{:02}-{:02}-{:02}'.format(
kind,
date.year, date.month, date.day,