File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -1020,6 +1020,21 @@ def test_header_offset(self):
1020
1020
"iso8859-1" , "strict" )
1021
1021
self .assertEqual (tarinfo .type , self .longnametype )
1022
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
+
1023
1038
1024
1039
class GNUReadTest (LongnameTest , ReadTest , unittest .TestCase ):
1025
1040
You can’t perform that action at this time.
0 commit comments