summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2018-10-31 16:16:37 +0100
committerRobin Appelman <robin@icewind.nl>2018-10-31 21:10:51 +0100
commitc6a48110bfbf5b3f100b0f2fc092e806e079e34e (patch)
tree1c716906f2a95a3a6959370eea639d1884d23962
parent3477517cb78bd84836c011e14dd50d3fe82a31ab (diff)
downloadnextcloud-server-c6a48110bfbf5b3f100b0f2fc092e806e079e34e.tar.gz
nextcloud-server-c6a48110bfbf5b3f100b0f2fc092e806e079e34e.zip
allways fall back to fopen for encryption wrapper
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r--lib/private/Files/Storage/Wrapper/Encryption.php9
-rw-r--r--lib/private/Files/Storage/Wrapper/Wrapper.php17
2 files changed, 25 insertions, 1 deletions
diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php
index 42653b2d4a6..e1c1225e0cc 100644
--- a/lib/private/Files/Storage/Wrapper/Encryption.php
+++ b/lib/private/Files/Storage/Wrapper/Encryption.php
@@ -1029,4 +1029,13 @@ class Encryption extends Wrapper {
}
+ public function writeStream(string $path, $stream, int $size = null): int {
+ // always fall back to fopen
+ $target = $this->fopen($path, 'w');
+ list($count, $result) = \OC_Helper::streamCopy($stream, $target);
+ fclose($stream);
+ fclose($target);
+ return $count;
+ }
+
}
diff --git a/lib/private/Files/Storage/Wrapper/Wrapper.php b/lib/private/Files/Storage/Wrapper/Wrapper.php
index 060c596ad65..f9c84b89fe5 100644
--- a/lib/private/Files/Storage/Wrapper/Wrapper.php
+++ b/lib/private/Files/Storage/Wrapper/Wrapper.php
@@ -32,9 +32,10 @@ namespace OC\Files\Storage\Wrapper;
use OCP\Files\InvalidPathException;
use OCP\Files\Storage\ILockingStorage;
use OCP\Files\Storage\IStorage;
+use OCP\Files\Storage\IWriteStreamStorage;
use OCP\Lock\ILockingProvider;
-class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage {
+class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStreamStorage {
/**
* @var \OC\Files\Storage\Storage $storage
*/
@@ -621,4 +622,18 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage {
public function needsPartFile() {
return $this->getWrapperStorage()->needsPartFile();
}
+
+ public function writeStream(string $path, $stream, int $size = null): int {
+ $storage = $this->getWrapperStorage();
+ if ($storage->instanceOfStorage(IWriteStreamStorage::class)) {
+ /** @var IWriteStreamStorage $storage */
+ return $storage->writeStream($path, $stream, $size);
+ } else {
+ $target = $this->fopen($path, 'w');
+ list($count, $result) = \OC_Helper::streamCopy($stream, $target);
+ fclose($stream);
+ fclose($target);
+ return $count;
+ }
+ }
}