summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2015-10-15 12:06:49 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2015-10-15 16:27:38 +0200
commitc7883b1769eb785264abcbf84a363100ff784228 (patch)
treede761da7159fe31626ccbef3926f1f1252e4ea26 /lib
parentb876f8b2a7c40dc23de4849f6a9157ae8150988b (diff)
downloadnextcloud-server-c7883b1769eb785264abcbf84a363100ff784228.tar.gz
nextcloud-server-c7883b1769eb785264abcbf84a363100ff784228.zip
only wrap source if fopen was successful
Diffstat (limited to 'lib')
-rw-r--r--lib/private/files/storage/wrapper/encryption.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/private/files/storage/wrapper/encryption.php b/lib/private/files/storage/wrapper/encryption.php
index d6b7f53408f..aade7cd8bb1 100644
--- a/lib/private/files/storage/wrapper/encryption.php
+++ b/lib/private/files/storage/wrapper/encryption.php
@@ -320,7 +320,7 @@ class Encryption extends Wrapper {
*
* @param string $path
* @param string $mode
- * @return resource
+ * @return resource|bool
* @throws GenericEncryptionException
* @throws ModuleDoesNotExistsException
*/
@@ -404,6 +404,9 @@ class Encryption extends Wrapper {
if ($shouldEncrypt === true && $encryptionModule !== null) {
$headerSize = $this->getHeaderSize($path);
$source = $this->storage->fopen($path, $mode);
+ if (!is_resource($source)) {
+ return false;
+ }
$handle = \OC\Files\Stream\Encryption::wrap($source, $path, $fullPath, $header,
$this->uid, $encryptionModule, $this->storage, $this, $this->util, $this->fileHelper, $mode,
$size, $unencryptedSize, $headerSize);