mirror of
https://github.com/nextcloud/richdocuments.git
synced 2025-12-18 05:20:43 +01:00
fix: Avoid failing on fopen for NonExistingFiles
Signed-off-by: Julius Knorr <jus@bitgrid.net>
This commit is contained in:
parent
31c8db6639
commit
07dc03baaa
1 changed files with 7 additions and 1 deletions
|
|
@ -14,6 +14,7 @@ use OCA\Richdocuments\PermissionManager;
|
|||
use OCP\Files\Folder;
|
||||
use OCP\Files\ForbiddenException;
|
||||
use OCP\Files\IRootFolder;
|
||||
use OCP\Files\NotFoundException;
|
||||
use OCP\Files\Storage\ISharedStorage;
|
||||
use OCP\Files\Storage\IStorage;
|
||||
use OCP\IUserSession;
|
||||
|
|
@ -93,7 +94,12 @@ class SecureViewWrapper extends Wrapper {
|
|||
|
||||
$isSharedStorage = $storage->instanceOfStorage(ISharedStorage::class);
|
||||
$mountNode = $this->rootFolder->get($storage->getMountPoint());
|
||||
$node = $mountNode instanceof Folder ? $mountNode->get($path) : $mountNode;
|
||||
try {
|
||||
$node = $mountNode instanceof Folder ? $mountNode->get($path) : $mountNode;
|
||||
} catch (NotFoundException $e) {
|
||||
// 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));
|
||||
}
|
||||
$share = $isSharedStorage ? $node->getStorage()->getShare() : null;
|
||||
$userId = $this->userSession->getUser()?->getUID();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue