fix: check that share is a folder before trying to acces sub-folders
parent
c85a611651
commit
5d884a564c
|
@ -21,8 +21,14 @@ class FoldersController extends GenericApiController
|
||||||
public function sub(string $folder): Http\Response
|
public function sub(string $folder): Http\Response
|
||||||
{
|
{
|
||||||
return Util::guardEx(function () use ($folder) {
|
return Util::guardEx(function () use ($folder) {
|
||||||
|
$share = $this->fs->getShareNode();
|
||||||
|
if ($share instanceof Folder) {
|
||||||
|
$rootNode = $share;
|
||||||
|
} else {
|
||||||
|
$rootNode = Util::getUserFolder();
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$rootNode = $this->fs->getShareNode() ?? Util::getUserFolder();
|
|
||||||
$node = $rootNode->get($folder);
|
$node = $rootNode->get($folder);
|
||||||
} catch (\OCP\Files\NotFoundException) {
|
} catch (\OCP\Files\NotFoundException) {
|
||||||
throw Exceptions::NotFound('Folder not found');
|
throw Exceptions::NotFound('Folder not found');
|
||||||
|
|
Loading…
Reference in New Issue