Hi,
After updating laravel-medialibrary beyond 7.14.2
Downloaded zip files (generated by MediaStream) could no longer be opened.
Attaching a screenshot
https://share.getcloudapp.com/z8un7dWz
For now I downgrade back to laravel-medialibrary 7.14.2 as it is the last working version where downloaded generated zip file could be opened. So my guess is something in 7.16.0 broke it
Thank you! :)
Hi @ziming could you send a corrupt zip file as example? I think this has something to do with #1604, but checking the zip file will provide me more info about the crash.
Hi, I have the same problem. I attach the file so you can check.
Hi @gabrielesbaiz, could it be that there are no files in the archive? In one extractor the archive crashes, in another it opens but says the archive is empty. Could you provide an archive with at least one file so I can do some more testing?
Thanks!
For mine it is a pdf file in the zip.
@ziming could you please share your zip file?
A sample pdf inside. Hope it helps
@ziming Sorry for the late response, we all had some vacation here 馃槃
When I open the documents.zip file I've no problems opening it and extracting the zip file, I've also checked the zip integrity and this all looks correct.
Well I just tried again and I can't. I'm on Mac OS Mojave 10.14.6 if it helps.
I'm on 10.15.1 tried both the default extractor and the unarchiver, both work without problems, this is the file you've put in the zip:
credit-bureau-report-28_Dec_2019.pdf
Can you try downloading the unarchiver and check if that works?
This is the default extractor
Update:
It works with the unarchiver. But not the default extractor.
My friends on windows appears to have problem opening it too.
Okay so some digging in the binary learned something:
50 4B 03 04 2D 00 08 00 08 00 2C 79 9C 4F 00 00 00 00
Those last 4 zero pairs are the CRC of the Zip Archive, they are null and probably shouldn't. I think the unarchiver ignores this and doesn't do a checksum but other extractors do and fail. I guess this has something todo with this PR: https://github.com/spatie/laravel-medialibrary/pull/1604. I will tomorrow check if removing this flag solves the issue if so we need to find a solution or undo the PR.
Hi @ziming,
Since I cannot test on my computer if the zipfile is broken, can you please in your projects vendor directory change the following line:
to:
$zip = new ZipStream($this->zipName);
And check of the problem still occurs?
Okay let me try it now and get back to you
Yup! it works after I change the line in this package src/MediaStream as mentioned
I upgraded medialibrary from 7.14.2 to the latest 7.18.0
Upload a file, tried to download, can't open zip.
Then I change that line in src/MediaStream.php as mentioned.
Tried download again, able to open zip this time.
Hope this helps and get merged!
Hi everyone, just tagged a new release https://github.com/spatie/laravel-medialibrary/releases/tag/7.18.1 that disables the zero header, can you please check if everything is working as expected?
Most helpful comment
Hi everyone, just tagged a new release https://github.com/spatie/laravel-medialibrary/releases/tag/7.18.1 that disables the zero header, can you please check if everything is working as expected?