aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_encryption
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2014-03-31 12:43:38 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2014-03-31 15:29:16 +0200
commitaa867ad647677d9648f746681adde630fed60850 (patch)
treec06b6e6a5af1ace278056ab414bc0585e9ebed4a /apps/files_encryption
parent8ebb1f15d31b449401c7f2b726007aaff78a4879 (diff)
downloadnextcloud-server-aa867ad647677d9648f746681adde630fed60850.tar.gz
nextcloud-server-aa867ad647677d9648f746681adde630fed60850.zip
don't call getFileInfo() to avoid to open the same file twice
Diffstat (limited to 'apps/files_encryption')
-rw-r--r--apps/files_encryption/lib/stream.php28
1 files changed, 16 insertions, 12 deletions
diff --git a/apps/files_encryption/lib/stream.php b/apps/files_encryption/lib/stream.php
index 58ac03373a7..1a163db887c 100644
--- a/apps/files_encryption/lib/stream.php
+++ b/apps/files_encryption/lib/stream.php
@@ -568,21 +568,25 @@ class Stream {
// part file.
$path = Helper::stripPartialFileExtension($this->rawPath);
- // get file info
- $fileInfo = $this->rootView->getFileInfo($path);
- if ($fileInfo) {
- // set encryption data
- $fileInfo['encrypted'] = true;
- $fileInfo['size'] = $this->size;
- $fileInfo['unencrypted_size'] = $this->unencryptedSize;
-
- // set fileinfo
- $this->rootView->putFileInfo($path, $fileInfo);
- }
+ $fileInfo = array(
+ 'encrypted' => true,
+ 'size' => $this->size,
+ 'unencrypted_size' => $this->unencryptedSize,
+ );
+
+ // set fileinfo
+ $this->rootView->putFileInfo($path, $fileInfo);
}
- return fclose($this->handle);
+ $result = fclose($this->handle);
+
+ if ($result === false) {
+ \OCP\Util::writeLog('Encryption library', 'Could not close stream, file could be corrupted', \OCP\Util::FATAL);
+ }
+
+ return $result;
+
}
}