diff --git a/lib/private/filechunking.php b/lib/private/filechunking.php index ece215e73449..32cbb7559f0a 100644 --- a/lib/private/filechunking.php +++ b/lib/private/filechunking.php @@ -74,14 +74,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; } /**