summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2024-03-20 14:09:58 +0100
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2024-03-22 19:44:47 +0000
commit680323216a197685e8b3d73443ed92e0b8a294b1 (patch)
tree9e7281178d8d6817ce59e8646b308fb9ff244c4d
parent812872ca4e17fb5b8f87c2d9fe95fb6fa52bfdf4 (diff)
downloadnextcloud-server-680323216a197685e8b3d73443ed92e0b8a294b1.tar.gz
nextcloud-server-680323216a197685e8b3d73443ed92e0b8a294b1.zip
fix: log error when default getWrapperStorage would return null
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r--lib/private/Files/Storage/Wrapper/Wrapper.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/private/Files/Storage/Wrapper/Wrapper.php b/lib/private/Files/Storage/Wrapper/Wrapper.php
index 665914df2a7..2c50bbdb11f 100644
--- a/lib/private/Files/Storage/Wrapper/Wrapper.php
+++ b/lib/private/Files/Storage/Wrapper/Wrapper.php
@@ -31,11 +31,14 @@
*/
namespace OC\Files\Storage\Wrapper;
+use OC\Files\Storage\FailedStorage;
use OCP\Files\InvalidPathException;
use OCP\Files\Storage\ILockingStorage;
use OCP\Files\Storage\IStorage;
use OCP\Files\Storage\IWriteStreamStorage;
use OCP\Lock\ILockingProvider;
+use OCP\Server;
+use Psr\Log\LoggerInterface;
class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStreamStorage {
/**
@@ -60,6 +63,12 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea
* @return \OC\Files\Storage\Storage
*/
public function getWrapperStorage() {
+ if (!$this->storage) {
+ $message = "storage wrapper " . get_class($this) . " doesn't have a wrapped storage set";
+ $logger = Server::get(LoggerInterface::class);
+ $logger->error($message);
+ $this->storage = new FailedStorage(['exception' => new \Exception($message)]);
+ }
return $this->storage;
}