Skip to content

Commit

Permalink
fix: None if file doesn't have name, use id + ext instead
Browse files Browse the repository at this point in the history
  • Loading branch information
hlf20010508 committed Dec 29, 2023
1 parent 9b31907 commit 70fa891
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/handlers/transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ async def transfer_handler(event):
try:
if "document" in event.media.to_dict():
name = event.file.name
if not name:
name = "%d%s" % (event.media.document.id, event.file.ext)
status_message = await Status_Message.create(event)
callback = Callback(event, status_message)
response_dict = await multi_parts_uploader(tg_client, message.media.document, name, progress_callback=callback)
Expand Down Expand Up @@ -73,6 +75,8 @@ async def transfer_handler(event):
try:
if "document" in message.media.to_dict():
name = message.file.name
if not name:
name = "%d%s" % (message.media.document.id, message.file.ext)
status_message = await Status_Message.create(event)
callback = Callback(event, status_message)
response_dict = await multi_parts_uploader(tg_client, message.media.document, name, progress_callback=callback)
Expand Down

0 comments on commit 70fa891

Please sign in to comment.