Skip to content

Header checksum is invalid on IOS downloading tar.gz file with UnityWebRequest (2019.4.8f1) #514

Closed
@silviaPixowl

Description

@silviaPixowl

Steps 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions