Merge pull request #286 from owncloud/default-root-for-saving
Use default root when saving a session
This commit is contained in:
commit
733f20bdd8
@ -107,7 +107,7 @@ class SessionController extends Controller{
|
|||||||
$file = new File($session->getFileId());
|
$file = new File($session->getFileId());
|
||||||
}
|
}
|
||||||
|
|
||||||
list($view, $path) = $file->getOwnerViewAndPath();
|
list($view, $path) = $file->getOwnerViewAndPath(true);
|
||||||
} catch (\Exception $e){
|
} catch (\Exception $e){
|
||||||
//File was deleted or unshared. We need to save content as new file anyway
|
//File was deleted or unshared. We need to save content as new file anyway
|
||||||
//Sorry, but for guests it would be lost :(
|
//Sorry, but for guests it would be lost :(
|
||||||
|
@ -148,7 +148,7 @@ class File {
|
|||||||
* @return string owner of the current file item
|
* @return string owner of the current file item
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function getOwnerViewAndPath(){
|
public function getOwnerViewAndPath($useDefaultRoot = false){
|
||||||
if ($this->isPublicShare()){
|
if ($this->isPublicShare()){
|
||||||
$rootLinkItem = \OCP\Share::resolveReShare($this->sharing[0]);
|
$rootLinkItem = \OCP\Share::resolveReShare($this->sharing[0]);
|
||||||
if (isset($rootLinkItem['uid_owner'])){
|
if (isset($rootLinkItem['uid_owner'])){
|
||||||
@ -160,7 +160,11 @@ class File {
|
|||||||
$path = $rootLinkItem['file_target'];
|
$path = $rootLinkItem['file_target'];
|
||||||
} else {
|
} else {
|
||||||
$owner = \OCP\User::getUser();
|
$owner = \OCP\User::getUser();
|
||||||
$view = new View('/' . $this->owner);
|
$root = '/' . $owner;
|
||||||
|
if ($useDefaultRoot){
|
||||||
|
$root .= '/' . 'files';
|
||||||
|
}
|
||||||
|
$view = new View($root);
|
||||||
$path = $view->getPath($this->fileId);
|
$path = $view->getPath($this->fileId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user