Header checksum is invalid on IOS downloading tar.gz file with UnityWebRequest (2019.4.8f1)
See original GitHub issueSteps to reproduce
1.Make a request to the server to download the gziped file 2. Use all possible examples from GZip and Tar Samples to try to decompress/extract contents 3. On unity editor and Android all works fine using the method below
public static void ExtractNestedTar(string gzArchiveName, string destFolder, bool deleteOriginal, Func<string, string> fileVersionExtractor)
{
var tmp = Path.Combine(destFolder, "tmp");
using (Stream inStream = File.OpenRead(gzArchiveName))
using (TarArchive tarArchive = TarArchive.CreateInputTarArchive(inStream)) {
tarArchive.ExtractContents(tmp);
System.Array.ForEach(new DirectoryInfo(tmp).GetDirectories(),
fl => Debug.Log($"Compressor: TMP file name {fl.Name}"));
foreach (var f in new DirectoryInfo(tmp).GetFiles("*.tar")) {
using (var s = f.OpenRead())
using (var t = TarArchive.CreateInputTarArchive(s)) {
string fileName = fileVersionExtractor.Invoke(f.Name);
t.ExtractContents(Path.Combine(destFolder, fileName));
}
}
}
if (!deleteOriginal) return;
File.Delete(gzArchiveName);
Directory.Delete(tmp, true);
}
Expected behavior
Be able to extract contents from tar.gz file on IOS
Actual behavior
When trying to parse header on IOS devices the checksum is invalid since checksum obtained from ParseOctal and the one obtained from MakeCheckSum are different.
I’m attaching the tar.gz file I got from unity and from IOS (strangely both have different sizes) I’m thinking that maybe from IOS side the gzipped file gets decompressed and encoded in some way not supported, but it’s just a hypothesis.
unityFile.tar.gz
IOSFile.tar.gz
Version of SharpZipLib
v1.2.0
Obtained from (only keep the relevant lines)
- Downloaded from GitHub
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Header checksum is invalid #160 - icsharpcode/SharpZipLib
gz compressed file, I'm using UnityWebRequest to download the file and I've tried to extract it using the Simple full extract from a...
Read more >Docker load and save: "archive/tar: invalid tar header"
It's a powershell issue. Powershell emits two byte characters to STDOUT, not one byte characters. If you look in the file you'll notice...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It worked :octocat: , I’m really grateful to you!
Thank you very much, I’ll try this and let you know 😃