Merge from 3.2: Issue #12926: Fix a bug in tarfile's link extraction.
On platforms that do not support (symbolic) links, tarfile offers a work-around and extracts a link in an archive as the regular file the link is pointing to. On other platforms, this code was accidentally executed even after the link had been successfully extracted which failed due to the already existing link.
This commit is contained in:
commit
8f771a4716
|
@ -2340,12 +2340,6 @@ class TarFile(object):
|
|||
self._extract_member(self._find_link_target(tarinfo),
|
||||
targetpath)
|
||||
except symlink_exception:
|
||||
if tarinfo.issym():
|
||||
linkpath = os.path.join(os.path.dirname(tarinfo.name),
|
||||
tarinfo.linkname)
|
||||
else:
|
||||
linkpath = tarinfo.linkname
|
||||
else:
|
||||
try:
|
||||
self._extract_member(self._find_link_target(tarinfo),
|
||||
targetpath)
|
||||
|
|
Loading…
Reference in New Issue