diff options
author | Robin Appelman <robin@icewind.nl> | 2024-03-11 17:07:49 +0100 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2024-03-22 15:42:45 +0000 |
commit | 459c17492bf723297b2fd8014274ca45d9751e4d (patch) | |
tree | 4e046b7b954863102bcb823e9479156c0d6c45e8 | |
parent | 812872ca4e17fb5b8f87c2d9fe95fb6fa52bfdf4 (diff) | |
download | nextcloud-server-459c17492bf723297b2fd8014274ca45d9751e4d.tar.gz nextcloud-server-459c17492bf723297b2fd8014274ca45d9751e4d.zip |
fix: don't return null for SharedStorage::getWrapperStorage with share recursion
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r-- | apps/files_sharing/lib/SharedStorage.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/apps/files_sharing/lib/SharedStorage.php b/apps/files_sharing/lib/SharedStorage.php index ad43e847d37..be5656d64b5 100644 --- a/apps/files_sharing/lib/SharedStorage.php +++ b/apps/files_sharing/lib/SharedStorage.php @@ -138,6 +138,16 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements ISharedSto 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; } |