-
Notifications
You must be signed in to change notification settings - Fork 980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Header checksum is invalid on IOS downloading tar.gz file with UnityWebRequest (2019.4.8f1) #514
Comments
As you pointed out, the sizes of the files are different, which means that the "source" file is not the same on iOS. Running the files through I think the problem lies outside of SharpZipLib, probaby in the way you are getting those files (you mention |
Thank you for your answer! I'm using UnityWebRequest to download the files from the server, it seems that on IOS side the gzip files gets decompress natively and encoded, but I'm not sure what type of encoding are they using to be able to decode it. What is weird though is that if I open the IOS file I attached on my Mac it will work fine (decompress it and expose the contents) even on IOS, if I move it to some folder where I can preview it, it can show me all the files contained and also a preview of each. |
I found the reason!
The IOSFile is not just a Gzipped TAR, it's a Gzipped Gzipped TAR 😁 bsdtar (which is used by macOS) identifies the double gzip header and correctly extracts it, but GNUtar fails wih 'invalid header'. As for your solution (if you cannot change whatever procedure is producing the archives, as it is compressing the archive twice, which just increases the resulting file size by at least 10 bytes), you should be able to just add another layer of using (var inStream = File.OpenRead(gzArchiveName))
using (var gzipStreamOuter = new GZipInputStream(inStream))
using (var gzipStreamInner = new GZipInputStream(gzipStreamOuter))
using (var tarArchive = TarArchive.CreateInputTarArchive(gzipStreamInner))
{
tarArchive.ExtractContents(destFolder);
} But this will of course not work for the |
Thank you very much, I'll try this and let you know :) |
It worked |
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
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)
The text was updated successfully, but these errors were encountered: