diff options
author | Robin Appelman <icewind@owncloud.com> | 2014-10-16 15:17:12 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2014-10-24 12:32:55 +0200 |
commit | 4438c7de1d0a66bb2c4eaff3bd718e5c946caa6f (patch) | |
tree | 350d5f576322c2bb9de282be1aa45851d442bb07 | |
parent | 6ed9f53fcdba3ec4b3e934f731ea0437329ab9b0 (diff) | |
download | nextcloud-server-4438c7de1d0a66bb2c4eaff3bd718e5c946caa6f.tar.gz nextcloud-server-4438c7de1d0a66bb2c4eaff3bd718e5c946caa6f.zip |
Fix shared cache getFolderContents
-rw-r--r-- | apps/files_sharing/lib/cache.php | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/apps/files_sharing/lib/cache.php b/apps/files_sharing/lib/cache.php index e4fd85fd2a7..270ed704bbd 100644 --- a/apps/files_sharing/lib/cache.php +++ b/apps/files_sharing/lib/cache.php @@ -145,26 +145,23 @@ class Shared_Cache extends Cache { /** * get the metadata of all files stored in $folder * - * @param string $folder + * @param string $folderId * @return array */ - public function getFolderContents($folder) { - - if ($folder === false) { - $folder = ''; - } - - $dir = ($folder !== '') ? $folder . '/' : ''; - - $cache = $this->getSourceCache($folder); + public function getFolderContentsById($folderId) { + $cache = $this->getSourceCache(''); if ($cache) { - $parent = $this->storage->getFile($folder); - $sourceFolderContent = $cache->getFolderContents($this->files[$folder]); - foreach ($sourceFolderContent as $key => $c) { - $sourceFolderContent[$key]['path'] = $dir . $c['name']; - $sourceFolderContent[$key]['uid_owner'] = $parent['uid_owner']; - $sourceFolderContent[$key]['displayname_owner'] = \OC_User::getDisplayName($parent['uid_owner']); - $sourceFolderContent[$key]['permissions'] = $sourceFolderContent[$key]['permissions'] & $this->storage->getPermissions($dir . $c['name']); + $owner = $this->storage->getSharedFrom(); + $parentPath = $this->getPathById($folderId); + if ($parentPath !== '') { + $parentPath .= '/'; + } + $sourceFolderContent = $cache->getFolderContentsById($folderId); + foreach ($sourceFolderContent as &$c) { + $c['path'] = ltrim($parentPath . $c['name'], '/'); + $c['uid_owner'] = $owner; + $c['displayname_owner'] = \OC_User::getDisplayName($owner); + $c['permissions'] = $c['permissions'] & $this->storage->getPermissions(false); } return $sourceFolderContent; |