From 2991bbf33701b0a54619bda63d6c71cbbfff0faf Mon Sep 17 00:00:00 2001 From: Victor Dubiniuk Date: Thu, 26 Jun 2014 18:21:51 +0300 Subject: [PATCH] Use default root when saving a session --- ajax/sessionController.php | 2 +- lib/file.php | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ajax/sessionController.php b/ajax/sessionController.php index a803d289..fbee3c9c 100644 --- a/ajax/sessionController.php +++ b/ajax/sessionController.php @@ -107,7 +107,7 @@ class SessionController extends Controller{ $file = new File($session->getFileId()); } - list($view, $path) = $file->getOwnerViewAndPath(); + list($view, $path) = $file->getOwnerViewAndPath(true); } catch (\Exception $e){ //File was deleted or unshared. We need to save content as new file anyway //Sorry, but for guests it would be lost :( diff --git a/lib/file.php b/lib/file.php index 056281e7..a880aa06 100644 --- a/lib/file.php +++ b/lib/file.php @@ -148,7 +148,7 @@ class File { * @return string owner of the current file item * @throws \Exception */ - public function getOwnerViewAndPath(){ + public function getOwnerViewAndPath($useDefaultRoot = false){ if ($this->isPublicShare()){ $rootLinkItem = \OCP\Share::resolveReShare($this->sharing[0]); if (isset($rootLinkItem['uid_owner'])){ @@ -160,7 +160,11 @@ class File { $path = $rootLinkItem['file_target']; } else { $owner = \OCP\User::getUser(); - $view = new View('/' . $this->owner); + $root = '/' . $owner; + if ($useDefaultRoot){ + $root .= '/' . 'files'; + } + $view = new View($root); $path = $view->getPath($this->fileId); }