diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php index 23290b5b20..50f30594b4 100644 --- a/apps/files_encryption/lib/proxy.php +++ b/apps/files_encryption/lib/proxy.php @@ -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; }