Skip to content
Myr

Merge commit from fork

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Nate Prewitt · committed by GitHub · parent 8b9bc8f · Browse files · 1 file+7 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+7 added−6 removed

  • other:+7 added−6 removed

1 file+7 added−6 removed

modified:src/requests/utils.py+7 added-6 removed
280 unmodified lines
281 if member not in zip_file.namelist():282 return path283284 # we have a valid zip archive and a valid member of that archive285 tmp = tempfile.gettempdir()286 extracted_path = os.path.join(tmp, member.split("/")[-1])287 if not os.path.exists(extracted_path):288 # use read + write to avoid the creating nested folders, we only want the file, avoids mkdir racing condition289 with atomic_open(extracted_path) as file_handler:290 file_handler.write(zip_file.read(member))285 suffix = os.path.splitext(member.split("/")[-1])[-1]286 fd, extracted_path = tempfile.mkstemp(suffix=suffix)287 try:288 os.write(fd, zip_file.read(member))289 finally:290 os.close(fd)291292 return extracted_path293294295@contextlib.contextmanager
791 unmodified lines