diff options
author | Robin Appelman <robin@icewind.nl> | 2024-03-20 14:09:58 +0100 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2024-03-22 19:44:47 +0000 |
commit | 680323216a197685e8b3d73443ed92e0b8a294b1 (patch) | |
tree | 9e7281178d8d6817ce59e8646b308fb9ff244c4d | |
parent | 812872ca4e17fb5b8f87c2d9fe95fb6fa52bfdf4 (diff) | |
download | nextcloud-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.php | 9 |
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; } |