Skip to content

Commit

Permalink
Merge pull request #22538 from nextcloud/backport/22535/stable18
Browse files Browse the repository at this point in the history
[stable18] Only disable zip64 if the size is known
  • Loading branch information
rullzer committed Sep 3, 2020
2 parents acb893c + e44f56e commit 300f571
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/private/Streamer.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,12 @@ public function __construct(IRequest $request, int $size, int $numberOfFiles){
* would still be possible to create an invalid zip32 file (for example,
* a zip file from files smaller than 4GB with a central directory
* larger than 4GiB), but it should not happen in the real world.
*
* We also have to check for a size above 0. As negative sizes could be
* from not fully scanned external storages. And then things fall apart
* if somebody tries to package to much.
*/
if ($size < 4 * 1000 * 1000 * 1000 && $numberOfFiles < 65536) {
if ($size > 0 && $size < 4 * 1000 * 1000 * 1000 && $numberOfFiles < 65536) {
$this->streamerInstance = new ZipStreamer(['zip64' => false]);
} else if ($request->isUserAgent($this->preferTarFor)) {
$this->streamerInstance = new TarStreamer();
Expand Down

0 comments on commit 300f571

Please sign in to comment.