diff --git a/lib/private/filechunking.php b/lib/private/filechunking.php index 8c341df4a8be..7b88bfecd19d 100644 --- a/lib/private/filechunking.php +++ b/lib/private/filechunking.php @@ -75,14 +75,16 @@ public function store($index, $data) { public function isComplete() { $prefix = $this->getPrefix(); - $parts = 0; $cache = $this->getCache(); - for($i=0; $i < $this->info['chunkcount']; $i++) { - if ($cache->hasKey($prefix.$i)) { - $parts ++; + $chunkcount = (int)$this->info['chunkcount']; + + for($i=($chunkcount-1); $i >= 0; $i--) { + if (!$cache->hasKey($prefix.$i)) { + return false; } } - return $parts == $this->info['chunkcount']; + + return true; } /**