Skip to content
Snippets Groups Projects
Commit fbbc76f2 authored by Florin Peter's avatar Florin Peter
Browse files

fix for sharing files

parent b1c4464e
No related branches found
No related tags found
No related merge requests found
...@@ -153,9 +153,9 @@ class Proxy extends \OC_FileProxy { ...@@ -153,9 +153,9 @@ class Proxy extends \OC_FileProxy {
$data = $encData; $data = $encData;
// Update the file cache with file info // Update the file cache with file info
\OC\Files\Filesystem::putFileInfo( $path, array( 'encrypted'=>true, 'size' => $size ), '' ); \OC\Files\Filesystem::putFileInfo( $filePath, array( 'encrypted'=>true, 'size' => strlen($size), 'unencrypted_size' => $size), '' );
// Re-enable proxy - our work is done // Re-enable proxy - our work is done
\OC_FileProxy::$enabled = $proxyStatus; \OC_FileProxy::$enabled = $proxyStatus;
} }
...@@ -437,24 +437,25 @@ class Proxy extends \OC_FileProxy { ...@@ -437,24 +437,25 @@ class Proxy extends \OC_FileProxy {
$fileInfo = \OC\Files\Filesystem::getFileInfo($path_f); $fileInfo = \OC\Files\Filesystem::getFileInfo($path_f);
// if file is encrypted return real file size // 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']; $size = $fileInfo['unencrypted_size'];
} else { } else {
// self healing if file was removed from file cache // self healing if file was removed from file cache
$userId = \OCP\User::getUser(); if(is_array($fileInfo)) {
$util = new Util( $view, $userId ); $userId = \OCP\User::getUser();
$fixSize = $util->getFileSize($path); $util = new Util( $view, $userId );
if($fixSize > 0) { $fixSize = $util->getFileSize($path);
$size = $fixSize; 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; return $size;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment