diff options
-rw-r--r-- | apps/files_sharing/lib/helper.php | 2 | ||||
-rw-r--r-- | apps/files_sharing/lib/sharedstorage.php | 26 | ||||
-rw-r--r-- | apps/files_sharing/lib/updater.php | 5 |
3 files changed, 9 insertions, 24 deletions
diff --git a/apps/files_sharing/lib/helper.php b/apps/files_sharing/lib/helper.php index c7347539fcc..7a5b859826c 100644 --- a/apps/files_sharing/lib/helper.php +++ b/apps/files_sharing/lib/helper.php @@ -125,7 +125,7 @@ class Helper { $ids = array(); - while ($path !== '' && $path !== '.' && $path !== '/') { + while ($path !== dirname($path)) { $info = $ownerView->getFileInfo($path); if ($info instanceof \OC\Files\FileInfo) { $ids[] = $info['fileid']; diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php index 4733dff3d14..d4a817fca34 100644 --- a/apps/files_sharing/lib/sharedstorage.php +++ b/apps/files_sharing/lib/sharedstorage.php @@ -102,14 +102,15 @@ class Shared extends \OC\Files\Storage\Common { /** * @brief Get the permissions granted for a shared file * @param string Shared target file path - * @return int CRUDS permissions granted or false if not found + * @return int CRUDS permissions granted */ public function getPermissions($target) { - $source = $this->getFile($target); - if ($source) { - return $source['permissions']; + $permissions = $this->share['permissions']; + // part file are always have delete permissions + if (pathinfo($target, PATHINFO_EXTENSION) === 'part') { + $permissions |= \OCP\PERMISSION_DELETE; } - return false; + return $permissions; } public function mkdir($path) { @@ -183,9 +184,6 @@ class Shared extends \OC\Files\Storage\Common { } public function isCreatable($path) { - if ($path == '') { - $path = $this->getMountPoint(); - } return ($this->getPermissions($path) & \OCP\PERMISSION_CREATE); } @@ -194,23 +192,14 @@ class Shared extends \OC\Files\Storage\Common { } public function isUpdatable($path) { - if ($path == '') { - $path = $this->getMountPoint(); - } return ($this->getPermissions($path) & \OCP\PERMISSION_UPDATE); } public function isDeletable($path) { - if ($path == '') { - $path = $this->getMountPoint(); - } return ($this->getPermissions($path) & \OCP\PERMISSION_DELETE); } public function isSharable($path) { - if ($path == '') { - $path = $this->getMountPoint(); - } return ($this->getPermissions($path) & \OCP\PERMISSION_SHARE); } @@ -454,9 +443,6 @@ class Shared extends \OC\Files\Storage\Common { } public function free_space($path) { - if ($path == '') { - $path = $this->getMountPoint(); - } $source = $this->getSourcePath($path); if ($source) { list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source); diff --git a/apps/files_sharing/lib/updater.php b/apps/files_sharing/lib/updater.php index 249211c306d..49044383df5 100644 --- a/apps/files_sharing/lib/updater.php +++ b/apps/files_sharing/lib/updater.php @@ -38,14 +38,13 @@ class Shared_Updater { \OC\Files\Filesystem::initMountPoints($user); $view = new \OC\Files\View('/' . $user); if ($view->file_exists($path)) { - while ($path !== '/') { + while ($path !== dirname($path)) { $etag = $view->getETag($path); $view->putFileInfo($path, array('etag' => $etag)); $path = dirname($path); } } else { - error_log("error!" . 'can not update etags on ' . $path . ' for user ' . $user); - \OCP\Util::writeLog('files_sharing', 'can not update etags on ' . $path . ' for user ' . $user, \OCP\Util::ERROR); + \OCP\Util::writeLog('files_sharing', 'can not update etags on ' . $path . ' for user ' . $user . '. Path does not exists', \OCP\Util::DEBUG); } } |