Skip to content

Commit 0014260

Browse files
authored
Merge pull request #44419 from nextcloud/backport/44357/stable27
2 parents d07fa16 + 02b369b commit 0014260

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

apps/files_sharing/lib/SharedStorage.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,16 @@ public function getSourceStorage() {
545545

546546
public function getWrapperStorage() {
547547
$this->init();
548+
549+
/**
550+
* @psalm-suppress DocblockTypeContradiction
551+
*/
552+
if (!$this->storage) {
553+
$message = "no storage set after init for share " . $this->getShareId();
554+
$this->logger->error($message);
555+
$this->storage = new FailedStorage(['exception' => new \Exception($message)]);
556+
}
557+
548558
return $this->storage;
549559
}
550560

lib/private/Files/Storage/Wrapper/Wrapper.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,14 @@
3131
*/
3232
namespace OC\Files\Storage\Wrapper;
3333

34+
use OC\Files\Storage\FailedStorage;
3435
use OCP\Files\InvalidPathException;
3536
use OCP\Files\Storage\ILockingStorage;
3637
use OCP\Files\Storage\IStorage;
3738
use OCP\Files\Storage\IWriteStreamStorage;
3839
use OCP\Lock\ILockingProvider;
40+
use OCP\Server;
41+
use Psr\Log\LoggerInterface;
3942

4043
class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStreamStorage {
4144
/**
@@ -60,6 +63,12 @@ public function __construct($parameters) {
6063
* @return \OC\Files\Storage\Storage
6164
*/
6265
public function getWrapperStorage() {
66+
if (!$this->storage) {
67+
$message = "storage wrapper " . get_class($this) . " doesn't have a wrapped storage set";
68+
$logger = Server::get(LoggerInterface::class);
69+
$logger->error($message);
70+
$this->storage = new FailedStorage(['exception' => new \Exception($message)]);
71+
}
6372
return $this->storage;
6473
}
6574

0 commit comments

Comments
 (0)