aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files/Storage
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Files/Storage')
-rw-r--r--lib/private/Files/Storage/Common.php4
-rw-r--r--lib/private/Files/Storage/DAV.php10
-rw-r--r--lib/private/Files/Storage/Wrapper/Encryption.php28
3 files changed, 25 insertions, 17 deletions
diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php
index b1e02cf2e6c..2dc359169d7 100644
--- a/lib/private/Files/Storage/Common.php
+++ b/lib/private/Files/Storage/Common.php
@@ -550,8 +550,8 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage,
public function moveFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath): bool {
if (
- !$sourceStorage->instanceOfStorage(Encryption::class) &&
- $this->isSameStorage($sourceStorage)
+ !$sourceStorage->instanceOfStorage(Encryption::class)
+ && $this->isSameStorage($sourceStorage)
) {
// resolve any jailed paths
while ($sourceStorage->instanceOfStorage(Jail::class)) {
diff --git a/lib/private/Files/Storage/DAV.php b/lib/private/Files/Storage/DAV.php
index 10670d6331a..afd8f87e2de 100644
--- a/lib/private/Files/Storage/DAV.php
+++ b/lib/private/Files/Storage/DAV.php
@@ -350,7 +350,13 @@ class DAV extends Common {
}
}
- return $response->getBody();
+ $content = $response->getBody();
+
+ if ($content === null || is_string($content)) {
+ return false;
+ }
+
+ return $content;
case 'w':
case 'wb':
case 'a':
@@ -390,6 +396,8 @@ class DAV extends Common {
$this->writeBack($tmpFile, $path);
});
}
+
+ return false;
}
public function writeBack(string $tmpFile, string $path): void {
diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php
index 4d38d2d37aa..51a5f99908d 100644
--- a/lib/private/Files/Storage/Wrapper/Encryption.php
+++ b/lib/private/Files/Storage/Wrapper/Encryption.php
@@ -185,11 +185,11 @@ class Encryption extends Wrapper {
public function rename(string $source, string $target): bool {
$result = $this->storage->rename($source, $target);
- if ($result &&
+ if ($result
// versions always use the keys from the original file, so we can skip
// this step for versions
- $this->isVersion($target) === false &&
- $this->encryptionManager->isEnabled()) {
+ && $this->isVersion($target) === false
+ && $this->encryptionManager->isEnabled()) {
$sourcePath = $this->getFullPath($source);
if (!$this->util->isExcluded($sourcePath)) {
$targetPath = $this->getFullPath($target);
@@ -210,9 +210,9 @@ class Encryption extends Wrapper {
public function rmdir(string $path): bool {
$result = $this->storage->rmdir($path);
$fullPath = $this->getFullPath($path);
- if ($result &&
- $this->util->isExcluded($fullPath) === false &&
- $this->encryptionManager->isEnabled()
+ if ($result
+ && $this->util->isExcluded($fullPath) === false
+ && $this->encryptionManager->isEnabled()
) {
$this->keyStorage->deleteAllFileKeys($fullPath);
}
@@ -225,9 +225,9 @@ class Encryption extends Wrapper {
$metaData = $this->getMetaData($path);
if (
- !$this->is_dir($path) &&
- isset($metaData['encrypted']) &&
- $metaData['encrypted'] === true
+ !$this->is_dir($path)
+ && isset($metaData['encrypted'])
+ && $metaData['encrypted'] === true
) {
$fullPath = $this->getFullPath($path);
$module = $this->getEncryptionModule($path);
@@ -384,9 +384,9 @@ class Encryption extends Wrapper {
$size = $this->storage->filesize($path);
$result = $unencryptedSize;
- if ($unencryptedSize < 0 ||
- ($size > 0 && $unencryptedSize === $size) ||
- $unencryptedSize > $size
+ if ($unencryptedSize < 0
+ || ($size > 0 && $unencryptedSize === $size)
+ || $unencryptedSize > $size
) {
// check if we already calculate the unencrypted size for the
// given path to avoid recursions
@@ -634,8 +634,8 @@ class Encryption extends Wrapper {
): bool {
// for versions we have nothing to do, because versions should always use the
// key from the original file. Just create a 1:1 copy and done
- if ($this->isVersion($targetInternalPath) ||
- $this->isVersion($sourceInternalPath)) {
+ if ($this->isVersion($targetInternalPath)
+ || $this->isVersion($sourceInternalPath)) {
// remember that we try to create a version so that we can detect it during
// fopen($sourceInternalPath) and by-pass the encryption in order to
// create a 1:1 copy of the file