aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-03-09 15:06:44 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2016-03-09 15:06:44 +0100
commit0cc53ee06dafbd3984bbf1d554585a5731b500a9 (patch)
treec44b12dae00330edac5367c9159fef5a8ce06b85 /lib/private
parent42bcea1ef0f902e1b54e2a0ac23ca21840da88d6 (diff)
parent7301b43eb6a806f62897223db57f9ff51cb1afb5 (diff)
downloadnextcloud-server-0cc53ee06dafbd3984bbf1d554585a5731b500a9.tar.gz
nextcloud-server-0cc53ee06dafbd3984bbf1d554585a5731b500a9.zip
Merge pull request #22602 from owncloud/fix_slow_chunkcheck
Do not check all chunks of a chunked upload if we do not need to
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/filechunking.php12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/private/filechunking.php b/lib/private/filechunking.php
index ece215e7344..32cbb7559f0 100644
--- a/lib/private/filechunking.php
+++ b/lib/private/filechunking.php
@@ -74,14 +74,16 @@ class OC_FileChunking {
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;
}
/**