From cf46b35639e83619c431cd55255a3ed92d225e47 Mon Sep 17 00:00:00 2001 From: Dineshkarthik Date: Wed, 15 Jul 2020 12:44:46 +0200 Subject: [PATCH] fix: missing filename attribute --- media_downloader.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/media_downloader.py b/media_downloader.py index f3b0bcf..7b396ea 100644 --- a/media_downloader.py +++ b/media_downloader.py @@ -61,10 +61,10 @@ async def _get_media_meta( dt.utcfromtimestamp(media_obj.date).isoformat(), file_format ), ) - elif _type in ["photo", "video"]: - file_name = os.path.join(THIS_DIR, _type, "") else: - file_name = os.path.join(THIS_DIR, _type, media_obj.file_name) + file_name = os.path.join( + THIS_DIR, _type, getattr(media_obj, "file_name", None) or "" + ) return file_ref, file_name, file_format