From 16924cc238b7f5f2d4210c42f3e3bc18b8f820cd Mon Sep 17 00:00:00 2001 From: Ren-hongchen <1280656287@qq.com> Date: Wed, 15 Mar 2023 01:43:51 +0800 Subject: [PATCH] fix issue #6377 --- requests/utils.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/requests/utils.py b/requests/utils.py index a367417f8e..7e2fcef73e 100644 --- a/requests/utils.py +++ b/requests/utils.py @@ -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