fix saved file size for uploaded files

This commit is contained in:
Robin Appelman 2012-06-21 18:07:56 +02:00
parent d0455c5819
commit 56de98ed8c
2 changed files with 8 additions and 8 deletions

View File

@ -115,8 +115,9 @@ class OC_CryptStream{
$data=substr($block,0,$currentPos%8192).$data; $data=substr($block,0,$currentPos%8192).$data;
fseek($this->source,-($currentPos%8192),SEEK_CUR); fseek($this->source,-($currentPos%8192),SEEK_CUR);
} }
while(strlen($data)>0){ $currentPos=ftell($this->source);
if(strlen($data)<8192){ while($remainingLength=strlen($data)>0){
if($remainingLength<8192){
$this->writeCache=$data; $this->writeCache=$data;
$data=''; $data='';
}else{ }else{
@ -125,8 +126,7 @@ class OC_CryptStream{
$data=substr($data,8192); $data=substr($data,8192);
} }
} }
$currentPos=ftell($this->source); $this->size=max($this->size,$currentPos+$length);
$this->size=max($this->size,$currentPos);
return $length; return $length;
} }

View File

@ -72,14 +72,14 @@ class OC_FileCache{
$data=array_merge(OC_FileCache_Cached::$savedData[$path],$data); $data=array_merge(OC_FileCache_Cached::$savedData[$path],$data);
unset(OC_FileCache_Cached::$savedData[$path]); unset(OC_FileCache_Cached::$savedData[$path]);
} }
if(!isset($data['size']) or !isset($data['mtime'])){//save incomplete data for the next time we write it
OC_FileCache_Cached::$savedData[$path]=$data;
return;
}
if($id!=-1){ if($id!=-1){
self::update($id,$data); self::update($id,$data);
return; return;
} }
if(!isset($data['size']) or !isset($data['mtime'])){//save incomplete data for the next time we write it
OC_FileCache_Cached::$savedData[$path]=$data;
return;
}
if(!isset($data['encrypted'])){ if(!isset($data['encrypted'])){
$data['encrypted']=false; $data['encrypted']=false;
} }