summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-05-29 16:50:01 +0200
committerGitHub <noreply@github.com>2018-05-29 16:50:01 +0200
commit7f301be188bc8dd08f624e9ccc74f9795d347c2a (patch)
tree585cefe1c019701e7cdb3978d1b76af60692e426
parent1924fed83ef9d18c087f4c4321f67c5a0128696c (diff)
parent51724a35a4c6cec0fbb758b64239a13fc9b3381a (diff)
downloadnextcloud-server-7f301be188bc8dd08f624e9ccc74f9795d347c2a.tar.gz
nextcloud-server-7f301be188bc8dd08f624e9ccc74f9795d347c2a.zip
Merge pull request #9583 from nextcloud/files-home-userfolder
use getUserFolder instead of getFileInfo when constructing FilesHome
-rw-r--r--apps/dav/lib/Files/FilesHome.php9
-rw-r--r--apps/dav/lib/Files/RootCollection.php7
2 files changed, 9 insertions, 7 deletions
diff --git a/apps/dav/lib/Files/FilesHome.php b/apps/dav/lib/Files/FilesHome.php
index 63e7916edcf..1ff918aabbb 100644
--- a/apps/dav/lib/Files/FilesHome.php
+++ b/apps/dav/lib/Files/FilesHome.php
@@ -39,15 +39,12 @@ class FilesHome extends Directory {
* FilesHome constructor.
*
* @param array $principalInfo
+ * @param FileInfo $userFolder
*/
- public function __construct($principalInfo) {
+ public function __construct($principalInfo, FileInfo $userFolder) {
$this->principalInfo = $principalInfo;
$view = \OC\Files\Filesystem::getView();
- $rootInfo = $view->getFileInfo('');
- if (!($rootInfo instanceof FileInfo)) {
- throw new \Exception('Home does not exist');
- }
- parent::__construct($view, $rootInfo);
+ parent::__construct($view, $userFolder);
}
function delete() {
diff --git a/apps/dav/lib/Files/RootCollection.php b/apps/dav/lib/Files/RootCollection.php
index 59b6690a026..f5544693f2c 100644
--- a/apps/dav/lib/Files/RootCollection.php
+++ b/apps/dav/lib/Files/RootCollection.php
@@ -23,6 +23,7 @@
*/
namespace OCA\DAV\Files;
+use OCP\Files\FileInfo;
use Sabre\DAV\INode;
use Sabre\DAVACL\AbstractPrincipalCollection;
use Sabre\DAV\SimpleCollection;
@@ -48,7 +49,11 @@ class RootCollection extends AbstractPrincipalCollection {
// in the future this could be considered to be used for accessing shared files
return new SimpleCollection($name);
}
- return new FilesHome($principalInfo);
+ $userFolder = \OC::$server->getUserFolder();
+ if (!($userFolder instanceof FileInfo)) {
+ throw new \Exception('Home does not exist');
+ }
+ return new FilesHome($principalInfo, $userFolder);
}
function getName() {