fix for sharing files

This commit is contained in:
Florin Peter 2013-04-30 20:44:42 +02:00
parent b1c4464eda
commit fbbc76f281
1 changed files with 15 additions and 14 deletions

View File

@ -153,9 +153,9 @@ class Proxy extends \OC_FileProxy {
$data = $encData;
// Update the file cache with file info
\OC\Files\Filesystem::putFileInfo( $path, array( 'encrypted'=>true, 'size' => $size ), '' );
// Re-enable proxy - our work is done
\OC\Files\Filesystem::putFileInfo( $filePath, array( 'encrypted'=>true, 'size' => strlen($size), 'unencrypted_size' => $size), '' );
// Re-enable proxy - our work is done
\OC_FileProxy::$enabled = $proxyStatus;
}
@ -437,24 +437,25 @@ class Proxy extends \OC_FileProxy {
$fileInfo = \OC\Files\Filesystem::getFileInfo($path_f);
// if file is encrypted return real file size
if (is_array($fileInfo) && $fileInfo['encrypted'] == 1) {
if (is_array($fileInfo) && $fileInfo['encrypted'] === true) {
$size = $fileInfo['unencrypted_size'];
} else {
// self healing if file was removed from file cache
$userId = \OCP\User::getUser();
$util = new Util( $view, $userId );
$fixSize = $util->getFileSize($path);
if($fixSize > 0) {
$size = $fixSize;
if(is_array($fileInfo)) {
$userId = \OCP\User::getUser();
$util = new Util( $view, $userId );
$fixSize = $util->getFileSize($path);
if($fixSize > 0) {
$size = $fixSize;
$fileInfo['encrypted'] = 1;
$fileInfo['unencrypted_size'] = $size;
$fileInfo['encrypted'] = 1;
$fileInfo['unencrypted_size'] = $size;
// put file info
$view->putFileInfo( $path, $fileInfo );
// put file info
$view->putFileInfo( $path_f, $fileInfo );
}
}
}
return $size;
}