We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 579e985 commit ec54cd5Copy full SHA for ec54cd5
Lib/test/test_tarfile.py
@@ -1020,6 +1020,21 @@ def test_header_offset(self):
1020
"iso8859-1", "strict")
1021
self.assertEqual(tarinfo.type, self.longnametype)
1022
1023
+ def test_longname_directory(self):
1024
+ # Test reading a longlink directory. Issue #47231.
1025
+ longdir = ('a' * 101) + '/'
1026
+ with os_helper.temp_cwd():
1027
+ with tarfile.open(tmpname, 'w') as tar:
1028
+ tar.format = self.format
1029
+ try:
1030
+ os.mkdir(longdir)
1031
+ tar.add(longdir)
1032
+ finally:
1033
+ os.rmdir(longdir.rstrip("/"))
1034
+ with tarfile.open(tmpname) as tar:
1035
+ self.assertIsNotNone(tar.getmember(longdir))
1036
+ self.assertIsNotNone(tar.getmember(longdir.removesuffix('/')))
1037
+
1038
1039
class GNUReadTest(LongnameTest, ReadTest, unittest.TestCase):
1040
0 commit comments