Skip to content

Commit 99c2eaa

Browse files
committed
Add test
1 parent cde31ec commit 99c2eaa

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Lib/test/test_tarfile.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,14 @@ def test_add_dir_getmember(self):
254254
self.add_dir_and_getmember('bar')
255255
self.add_dir_and_getmember('a'*101)
256256

257+
def test_extract_name_with_trailing_slash(self):
258+
with tarfile.open(tmpname, 'w') as tar:
259+
tar.addfile(tarfile.TarInfo('./mydir/'))
260+
with tarfile.open(tmpname) as tar:
261+
names = tar.getnames()
262+
self.assertEqual(names, ['./mydir/'])
263+
tar.extract(names[0], TEMPDIR, filter='fully_trusted')
264+
257265
@unittest.skipUnless(hasattr(os, "getuid") and hasattr(os, "getgid"),
258266
"Missing getuid or getgid implementation")
259267
def add_dir_and_getmember(self, name):

0 commit comments

Comments
 (0)