summaryrefslogtreecommitdiffstats
path: root/lib/private/Streamer.php
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2020-09-01 11:24:01 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2020-09-01 15:01:12 +0200
commitab6bd79c02bd2de091c2fb9585f42e97d1e222df (patch)
treee17d44a888d0e5c038990061ef8ccd5c14afcdae /lib/private/Streamer.php
parent823f94bb0118d297df25ca9443e6c235a45bb5ab (diff)
downloadnextcloud-server-ab6bd79c02bd2de091c2fb9585f42e97d1e222df.tar.gz
nextcloud-server-ab6bd79c02bd2de091c2fb9585f42e97d1e222df.zip
Only disable zip64 if the size is known
Else we might run into the issue that for an external storage where the size is not known yet we do not use zip64. Which then of course fails on large zip files. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/private/Streamer.php')
-rw-r--r--lib/private/Streamer.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/private/Streamer.php b/lib/private/Streamer.php
index a05f77f3cbd..0e3018f77b7 100644
--- a/lib/private/Streamer.php
+++ b/lib/private/Streamer.php
@@ -76,8 +76,12 @@ class Streamer {
* 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]);
} elseif ($request->isUserAgent($this->preferTarFor)) {
$this->streamerInstance = new TarStreamer();