Issue #14160: TarFile.extractfile() failed to resolve symbolic links

when the links were not located in an archive subdirectory.
This commit is contained in:
Lars Gustäbel 2012-04-24 21:04:40 +02:00
parent d11d0d6343
commit 1ef9eda7bc
4 changed files with 7 additions and 1 deletions

View file

@ -2496,7 +2496,7 @@ class TarFile(object):
"""
if tarinfo.issym():
# Always search the entire archive.
linkname = os.path.dirname(tarinfo.name) + "/" + tarinfo.linkname
linkname = "/".join(filter(None, (os.path.dirname(tarinfo.name), tarinfo.linkname)))
limit = None
else:
# Search the archive before the link, because a hard link is