only wrap source if fopen was successful
This commit is contained in:
parent
b876f8b2a7
commit
c7883b1769
|
@ -320,7 +320,7 @@ class Encryption extends Wrapper {
|
||||||
*
|
*
|
||||||
* @param string $path
|
* @param string $path
|
||||||
* @param string $mode
|
* @param string $mode
|
||||||
* @return resource
|
* @return resource|bool
|
||||||
* @throws GenericEncryptionException
|
* @throws GenericEncryptionException
|
||||||
* @throws ModuleDoesNotExistsException
|
* @throws ModuleDoesNotExistsException
|
||||||
*/
|
*/
|
||||||
|
@ -404,6 +404,9 @@ class Encryption extends Wrapper {
|
||||||
if ($shouldEncrypt === true && $encryptionModule !== null) {
|
if ($shouldEncrypt === true && $encryptionModule !== null) {
|
||||||
$headerSize = $this->getHeaderSize($path);
|
$headerSize = $this->getHeaderSize($path);
|
||||||
$source = $this->storage->fopen($path, $mode);
|
$source = $this->storage->fopen($path, $mode);
|
||||||
|
if (!is_resource($source)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$handle = \OC\Files\Stream\Encryption::wrap($source, $path, $fullPath, $header,
|
$handle = \OC\Files\Stream\Encryption::wrap($source, $path, $fullPath, $header,
|
||||||
$this->uid, $encryptionModule, $this->storage, $this, $this->util, $this->fileHelper, $mode,
|
$this->uid, $encryptionModule, $this->storage, $this, $this->util, $this->fileHelper, $mode,
|
||||||
$size, $unencryptedSize, $headerSize);
|
$size, $unencryptedSize, $headerSize);
|
||||||
|
|
Loading…
Reference in New Issue