Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-06-21 20:07:56 +0400
committerRobin Appelman <icewind@owncloud.com>2012-06-21 20:07:56 +0400
commitda9107fe699e6e5dfe0df8921484178fee844f4c (patch)
tree628d5118d1d4eba30025d33348a37b04d8afbffc
parent7b4cb44af8016893113c0dd4cd6bdab269c98b0e (diff)
fix saved file size for uploaded files
-rw-r--r--apps/files_encryption/lib/cryptstream.php8
-rw-r--r--lib/filecache.php8
2 files changed, 8 insertions, 8 deletions
diff --git a/apps/files_encryption/lib/cryptstream.php b/apps/files_encryption/lib/cryptstream.php
index 901e8cccbfb..9949c1896a8 100644
--- a/apps/files_encryption/lib/cryptstream.php
+++ b/apps/files_encryption/lib/cryptstream.php
@@ -115,8 +115,9 @@ class OC_CryptStream{
$data=substr($block,0,$currentPos%8192).$data;
fseek($this->source,-($currentPos%8192),SEEK_CUR);
}
- while(strlen($data)>0){
- if(strlen($data)<8192){
+ $currentPos=ftell($this->source);
+ while($remainingLength=strlen($data)>0){
+ if($remainingLength<8192){
$this->writeCache=$data;
$data='';
}else{
@@ -125,8 +126,7 @@ class OC_CryptStream{
$data=substr($data,8192);
}
}
- $currentPos=ftell($this->source);
- $this->size=max($this->size,$currentPos);
+ $this->size=max($this->size,$currentPos+$length);
return $length;
}
diff --git a/lib/filecache.php b/lib/filecache.php
index 1d22bb34dfc..da9baa020a2 100644
--- a/lib/filecache.php
+++ b/lib/filecache.php
@@ -91,14 +91,14 @@ class OC_FileCache{
$data=array_merge(OC_FileCache::$savedData[$path],$data);
unset(OC_FileCache::$savedData[$path]);
}
- if(!isset($data['size']) or !isset($data['mtime'])){//save incomplete data for the next time we write it
- self::$savedData[$path]=$data;
- return;
- }
if($id!=-1){
self::update($id,$data);
return;
}
+ if(!isset($data['size']) or !isset($data['mtime'])){//save incomplete data for the next time we write it
+ self::$savedData[$path]=$data;
+ return;
+ }
if(!isset($data['encrypted'])){
$data['encrypted']=false;
}