brendan-duncan/archive

TarDecoder should support GNU long filenames

davidmorgan opened this issue · 4 comments

GNU tar puts filenames in files when they exceed tar's native length. The fix is pretty straightforward

String nextName = null;
for (var archiveFile in archive) {
  if (archiveFile.name == '././@LongLink') {
    nextName = archiveFile.rawContent.readString();
    continue;
  }
  var name = nextName ?? archiveFile.name;
  nextName = null;
  ...process the file here...
}

Sorry I totally slacked on looking into this. I added it to the tar decoder (locally), will test it and push it shortly. Thanks a lot for the code example!

I tested it and pushed the change. I'll publish the fix shortly.

Published. And also used the gnu tar method for encoding when it hits a name longer than 100 (tar header filename length).

Thanks!