fix: log error when default getWrapperStorage would return null

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2024-03-20 14:09:58 +01:00
parent c451829579
commit d5fa2ec7c3
No known key found for this signature in database
GPG Key ID: 42B69D8A64526EFB
1 changed files with 9 additions and 0 deletions

View File

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