mirror of
https://github.com/python/cpython.git
synced 2025-10-02 21:25:24 +00:00
[3.12] gh-114959: tarfile: do not ignore errors when extract a directory on top of a file (GH-114960) (GH-114963)
Also, add tests common to tarfile and zipfile.
(cherry picked from commit 96bce033c4
)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
c86a9e662f
commit
8ed20bc8bb
5 changed files with 220 additions and 1 deletions
|
@ -2449,7 +2449,8 @@ class TarFile(object):
|
|||
# later in _extract_member().
|
||||
os.mkdir(targetpath, 0o700)
|
||||
except FileExistsError:
|
||||
pass
|
||||
if not os.path.isdir(targetpath):
|
||||
raise
|
||||
|
||||
def makefile(self, tarinfo, targetpath):
|
||||
"""Make a file called targetpath.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue