mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Merge pull request #44415 from nextcloud/backport/44132/stable27
[stable27] fix: don't return null for SharedStorage::getWrapperStorage with share recursion
This commit is contained in:
commit
bc73ac6347
1 changed files with 19 additions and 0 deletions
|
|
@ -101,6 +101,12 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements ISharedSto
|
|||
|
||||
private static int $initDepth = 0;
|
||||
|
||||
/**
|
||||
* @psalm-suppress NonInvariantDocblockPropertyType
|
||||
* @var ?\OC\Files\Storage\Storage $storage
|
||||
*/
|
||||
protected $storage;
|
||||
|
||||
public function __construct($arguments) {
|
||||
$this->ownerView = $arguments['ownerView'];
|
||||
$this->logger = \OC::$server->getLogger();
|
||||
|
|
@ -136,8 +142,21 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements ISharedSto
|
|||
return $this->sourceRootInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert \OC\Files\Storage\Storage $this->storage
|
||||
*/
|
||||
private function init() {
|
||||
if ($this->initialized) {
|
||||
if (!$this->storage) {
|
||||
// marked as initialized but no storage set
|
||||
// this is probably because some code path has caused recursion during the share setup
|
||||
// we setup a "failed storage" so `getWrapperStorage` doesn't return null.
|
||||
// If the share setup completes after this the "failed storage" will be overwritten by the correct one
|
||||
$this->logger->warning('Possible share setup recursion detected');
|
||||
$this->storage = new FailedStorage(['exception' => new \Exception('Possible share setup recursion detected')]);
|
||||
$this->cache = new FailedCache();
|
||||
$this->rootPath = '';
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue