From 1a9f6895f752cceebf17a67ec8f734813e8f8eca Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 20 Dec 2017 13:18:07 +0100 Subject: [PATCH] calling /folder/ with an id will return the root folder --- restapi/index.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/restapi/index.php b/restapi/index.php index 1dc20f8ae..329aaefa6 100644 --- a/restapi/index.php +++ b/restapi/index.php @@ -182,10 +182,13 @@ function getLockedDocuments() { /* {{{ */ } } /* }}} */ -function getFolder($id) { /* {{{ */ - global $app, $dms, $userobj; +function getFolder($id = null) { /* {{{ */ + global $app, $dms, $userobj, $settings; $forcebyname = $app->request()->get('forcebyname'); - if(is_numeric($id) && empty($forcebyname)) + + if ($id === null) + $folder = $dms->getFolder($settings->_rootFolderID); + else if(is_numeric($id) && empty($forcebyname)) $folder = $dms->getFolder($id); else { $parentid = $app->request()->get('parentid'); @@ -1414,6 +1417,7 @@ $app->get('/logout', 'doLogout'); $app->get('/account', 'getAccount'); $app->get('/search', 'doSearch'); $app->get('/searchbyattr', 'doSearchByAttr'); +$app->get('/folder/', 'getFolder'); $app->get('/folder/:id', 'getFolder'); $app->post('/folder/:id/move', 'moveFolder'); $app->delete('/folder/:id', 'deleteFolder');