Skip to content

Commit

Permalink
fix issue psf#6377
Browse files Browse the repository at this point in the history
  • Loading branch information
Ren-hongchen committed Mar 14, 2023
1 parent 7f694b7 commit 16924cc
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions requests/utils.py
Expand Up @@ -290,10 +290,11 @@ def extract_zipped_paths(path):
# we have a valid zip archive and a valid member of that archive
tmp = tempfile.gettempdir()
extracted_path = os.path.join(tmp, member.split("/")[-1])
if not os.path.exists(extracted_path):
# use read + write to avoid the creating nested folders, we only want the file, avoids mkdir racing condition
with atomic_open(extracted_path) as file_handler:
file_handler.write(zip_file.read(member))

# use read + write to avoid the creating nested folders, we only want the file, avoids mkdir racing condition
with atomic_open(extracted_path) as file_handler:
file_handler.write(zip_file.read(member))

return extracted_path


Expand Down

0 comments on commit 16924cc

Please sign in to comment.