brendan-duncan / archive

Dart library to encode and decode various archive and compression formats, such as Zip, Tar, GZip, ZLib, and BZip2.
MIT License
395 stars 130 forks source link

fix filename extracted from tar archive in ustar format. #325

Closed daimg closed 4 months ago

daimg commented 4 months ago

Please refer to following links for filename in a tar archive with ustar format:

https://www.ibm.com/docs/en/aix/7.1?topic=files-tarh-file "The file's path name is created using this field, or by using this field in connection with the prefix field. If the prefix field is included, the name of the file is prefix/name. This field is null-terminated unless every character is non-null."

https://en.wikipedia.org/wiki/Tar_(computing)#UStar_format "The maximum filename size is 256, but it is split among a preceding path "filename prefix" and the filename itself "

https://www.gnu.org/software/tar/manual/html_chapter/Formats.html#Compression "File names longer than 100 bytes must be split at a directory separator in two parts, the first being at most 155 bytes long. So, in most cases file names must be a bit shorter than 255 bytes."