mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2026-09-06 00:42:02 +00:00
Support pathlib.Path on download/upload
This commit is contained in:
@@ -2,6 +2,7 @@ import hashlib
|
||||
import io
|
||||
import logging
|
||||
import os
|
||||
import pathlib
|
||||
import warnings
|
||||
from io import BytesIO
|
||||
from mimetypes import guess_type
|
||||
@@ -361,6 +362,9 @@ class UploadMethods(MessageParseMethods, UserMethods):
|
||||
if not file:
|
||||
return None, None
|
||||
|
||||
if isinstance(file, pathlib.Path):
|
||||
file = str(file.absolute())
|
||||
|
||||
if not isinstance(file, (str, bytes, io.IOBase)):
|
||||
# The user may pass a Message containing media (or the media,
|
||||
# or anything similar) that should be treated as a file. Try
|
||||
|
||||
Reference in New Issue
Block a user