summaryrefslogtreecommitdiffstats
path: root/lib/private/files/storage/wrapper/encryption.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2015-06-26 11:26:40 +0200
committerJoas Schilling <nickvergessen@owncloud.com>2015-06-26 13:17:23 +0200
commit9b336765b69bf7b7e2cd67a824862411b249aa4d (patch)
treeced65aed0f0a9ba4ce764ced0da1691abf595eb9 /lib/private/files/storage/wrapper/encryption.php
parent6c3a4282e5f24b5914b8d1afa869d9595fb14261 (diff)
downloadnextcloud-server-9b336765b69bf7b7e2cd67a824862411b249aa4d.tar.gz
nextcloud-server-9b336765b69bf7b7e2cd67a824862411b249aa4d.zip
Correctly check if the real file exists, otherwise try the part file
Diffstat (limited to 'lib/private/files/storage/wrapper/encryption.php')
-rw-r--r--lib/private/files/storage/wrapper/encryption.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/private/files/storage/wrapper/encryption.php b/lib/private/files/storage/wrapper/encryption.php
index 8d1f80c53c0..675978da2a9 100644
--- a/lib/private/files/storage/wrapper/encryption.php
+++ b/lib/private/files/storage/wrapper/encryption.php
@@ -350,7 +350,7 @@ class Encryption extends Wrapper {
$size = $unencryptedSize = 0;
$realFile = $this->util->stripPartialFileExtension($path);
- $targetExists = $this->file_exists($realFile);
+ $targetExists = $this->file_exists($realFile) || $this->file_exists($path);
$targetIsEncrypted = false;
if ($targetExists) {
// in case the file exists we require the explicit module as
@@ -608,7 +608,11 @@ class Encryption extends Wrapper {
$header = '';
$realFile = $this->util->stripPartialFileExtension($path);
if ($this->storage->file_exists($realFile)) {
- $handle = $this->storage->fopen($realFile, 'r');
+ $path = $realFile;
+ }
+
+ if ($this->storage->file_exists($path)) {
+ $handle = $this->storage->fopen($path, 'r');
$firstBlock = fread($handle, $this->util->getHeaderSize());
fclose($handle);
if (substr($firstBlock, 0, strlen(Util::HEADER_START)) === Util::HEADER_START) {