aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib/api.php
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2014-03-12 11:00:30 +0100
committerBjoern Schiessle <schiessle@owncloud.com>2014-03-13 15:16:59 +0100
commit9d32475260b71b97c3fc7f8bf63e1c51e55f210e (patch)
tree9154d279a3c8b83c3981855827444676c5ef3cca /apps/files_sharing/lib/api.php
parent1295e541736f3bf073013db72a49416821f5d4bc (diff)
downloadnextcloud-server-9d32475260b71b97c3fc7f8bf63e1c51e55f210e.tar.gz
nextcloud-server-9d32475260b71b97c3fc7f8bf63e1c51e55f210e.zip
finally fix the paths for the OCS Share API
Diffstat (limited to 'apps/files_sharing/lib/api.php')
-rw-r--r--apps/files_sharing/lib/api.php28
1 files changed, 24 insertions, 4 deletions
diff --git a/apps/files_sharing/lib/api.php b/apps/files_sharing/lib/api.php
index 7adbcab2f9b..de3c1cd2630 100644
--- a/apps/files_sharing/lib/api.php
+++ b/apps/files_sharing/lib/api.php
@@ -98,8 +98,14 @@ class Api {
break;
}
}
+ } else {
+ $path = $params['path'];
+ foreach ($shares as $key => $share) {
+ $shares[$key]['path'] = $path;
+ }
}
+
// include also reshares in the lists. This means that the result
// will contain every user with access to the file.
if (isset($params['reshares']) && $params['reshares'] === true) {
@@ -107,8 +113,10 @@ class Api {
}
if ($receivedFrom) {
- $shares['received_from'] = $receivedFrom['uid_owner'];
- $shares['received_from_displayname'] = \OCP\User::getDisplayName($receivedFrom['uid_owner']);
+ foreach ($shares as $key => $share) {
+ $shares[$key]['received_from'] = $receivedFrom['uid_owner'];
+ $shares[$key]['received_from_displayname'] = \OCP\User::getDisplayName($receivedFrom['uid_owner']);
+ }
}
} else {
$shares = null;
@@ -174,9 +182,10 @@ class Api {
$share = \OCP\Share::getItemShared($itemType, $file['fileid']);
if($share) {
$receivedFrom = \OCP\Share::getItemSharedWithBySource($itemType, $file['fileid']);
+ reset($share);
+ $key = key($share);
+ $share[$key]['path'] = self::correctPath($share[$key]['path'], $path);
if ($receivedFrom) {
- reset($share);
- $key = key($share);
$share[$key]['received_from'] = $receivedFrom['uid_owner'];
$share[$key]['received_from_displayname'] = \OCP\User::getDisplayName($receivedFrom['uid_owner']);
}
@@ -522,4 +531,15 @@ class Api {
}
+ /**
+ * @brief make sure that the path has the correct root
+ *
+ * @param string $path path returned from the share API
+ * @param string $folder current root folder
+ * @return string the correct path
+ */
+ protected static function correctPath($path, $folder) {
+ return \OC_Filesystem::normalizePath('/' . $folder . '/' . basename($path));
+ }
+
}