mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-27 12:28:09 +00:00
Avoid calling fdopen on closed descriptor
This commit is contained in:
parent
5bc10b45a3
commit
cd0e585d0d
@ -2299,6 +2299,17 @@ class Client:
|
||||
cdn_session.start()
|
||||
|
||||
try:
|
||||
# cant fdopen the closed file descriptor from above
|
||||
# which is closed due to the with statement in the branch just above
|
||||
# make a new temp file to write to
|
||||
|
||||
try:
|
||||
os.remove(file_name)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
fd, file_name = tempfile.mkstemp()
|
||||
|
||||
with os.fdopen(fd, "wb") as f:
|
||||
while True:
|
||||
r2 = cdn_session.send(
|
||||
|
Loading…
x
Reference in New Issue
Block a user