mirror of
https://github.com/nextcloud/richdocuments.git
synced 2025-12-18 05:20:43 +01:00
fix(SecureView): do not rely on specualtive getMountPoint()
- it is not specified by IStorage and exists only by luck - the Node instance already provides the IStorage Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
parent
b3c278878c
commit
eb3ba707c6
1 changed files with 6 additions and 8 deletions
|
|
@ -11,7 +11,6 @@ namespace OCA\Richdocuments\Storage;
|
|||
use OC\Files\Storage\Wrapper\Wrapper;
|
||||
use OCA\Richdocuments\Middleware\WOPIMiddleware;
|
||||
use OCA\Richdocuments\PermissionManager;
|
||||
use OCP\Files\Folder;
|
||||
use OCP\Files\ForbiddenException;
|
||||
use OCP\Files\IRootFolder;
|
||||
use OCP\Files\NotFoundException;
|
||||
|
|
@ -90,16 +89,15 @@ class SecureViewWrapper extends Wrapper {
|
|||
fclose($fp);
|
||||
}
|
||||
|
||||
$storage = $sourceStorage ?? $this;
|
||||
|
||||
$isSharedStorage = $storage->instanceOfStorage(ISharedStorage::class);
|
||||
$mountNode = $this->rootFolder->get($storage->getMountPoint());
|
||||
try {
|
||||
$node = $mountNode instanceof Folder ? $mountNode->get($path) : $mountNode;
|
||||
} catch (NotFoundException $e) {
|
||||
$node = $this->rootFolder->get($this->mountPoint . $path);
|
||||
} catch (NotFoundException) {
|
||||
// If the file is just created we may need to check the parent as this is only just about figuring out if it is a share
|
||||
$node = $mountNode->get(dirname($path));
|
||||
$node = $this->rootFolder->get(dirname($this->mountPoint . $path));
|
||||
}
|
||||
|
||||
$isSharedStorage = $node->getStorage()->instanceOfStorage(ISharedStorage::class);
|
||||
|
||||
$share = $isSharedStorage ? $node->getStorage()->getShare() : null;
|
||||
$userId = $this->userSession->getUser()?->getUID();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue