Skip to content

Commit b05605c

Browse files
committed
gh-151669: Normalize symlink targets in tarfile.TarFile.gettarinfo()
This applies a normalization complementary to the one added to tarfile.TarFile.extract() in gh-138309.
1 parent 15d7406 commit b05605c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Lib/tarfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2227,7 +2227,7 @@ def gettarinfo(self, name=None, arcname=None, fileobj=None):
22272227
type = FIFOTYPE
22282228
elif stat.S_ISLNK(stmd):
22292229
type = SYMTYPE
2230-
linkname = os.readlink(name)
2230+
linkname = os.readlink(name).replace(os.sep, "/")
22312231
elif stat.S_ISCHR(stmd):
22322232
type = CHRTYPE
22332233
elif stat.S_ISBLK(stmd):

0 commit comments

Comments
 (0)