mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-12-03 08:13:53 +03:00
parent
baf35e9e7e
commit
369bfe1a2a
|
|
@ -1054,8 +1054,11 @@ class DownloadMethods:
|
||||||
|
|
||||||
if os.path.isdir(file) or not file:
|
if os.path.isdir(file) or not file:
|
||||||
try:
|
try:
|
||||||
|
isreserved = getattr(os.path, 'isreserved', lambda _: False) # Python 3.13 and above
|
||||||
name = None if possible_names is None else next(
|
name = None if possible_names is None else next(
|
||||||
x for x in possible_names if x
|
x # basename to prevent path traversal (#4713)
|
||||||
|
for x in map(os.path.basename, possible_names)
|
||||||
|
if x and not isreserved(x)
|
||||||
)
|
)
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
name = None
|
name = None
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user