Browse Source

allways fall back to fopen for encryption wrapper

Signed-off-by: Robin Appelman <robin@icewind.nl>
tags/v15.0.0beta1
Robin Appelman 5 years ago
parent
commit
c6a48110bf
No account linked to committer's email address

+ 9
- 0
lib/private/Files/Storage/Wrapper/Encryption.php View File

@@ -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;
}

}

+ 16
- 1
lib/private/Files/Storage/Wrapper/Wrapper.php View File

@@ -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;
}
}
}

Loading…
Cancel
Save