Skip to content

Commit 03116fc

Browse files
Improve documentation
1 parent 92cfb2f commit 03116fc

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Doc/library/tarfile.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,6 +1107,10 @@ reused in custom filters:
11071107
paths (in case the name is absolute
11081108
even after stripping slashes, e.g. ``C:/foo`` on Windows).
11091109
This raises :class:`~tarfile.AbsolutePathError`.
1110+
- Normalize filenames (:attr:`TarInfo.name`) that contain ``..`` components
1111+
using :func:`os.path.normpath`.
1112+
Note that this removes internal ``..`` components, which may change the
1113+
meaning of the name if it traverses symbolic links.
11101114
- :ref:`Refuse <tarfile-extraction-refuse>` to extract files whose absolute
11111115
path (after following symlinks) would end up outside the destination.
11121116
This raises :class:`~tarfile.OutsideDestinationError`.
@@ -1115,6 +1119,10 @@ reused in custom filters:
11151119

11161120
Return the modified ``TarInfo`` member.
11171121

1122+
.. versionchanged:: next
1123+
1124+
Filenames containing ``..`` components are now normalized.
1125+
11181126
.. function:: data_filter(member, path)
11191127

11201128
Implements the ``'data'`` filter.

0 commit comments

Comments
 (0)