summaryrefslogtreecommitdiffstats
path: root/lib/private/share
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2015-10-07 10:38:22 +0200
committerMorris Jobke <hey@morrisjobke.de>2016-04-13 17:44:18 +0200
commit79c17cdfa604d73f7f24ec25bdaf60eaf65fedc6 (patch)
tree6930d3ac400a70e575d9ebc8ddf70f47a2244fe2 /lib/private/share
parent3c0a1d4241c16c13b3fd93406402320284d153d9 (diff)
downloadnextcloud-server-79c17cdfa604d73f7f24ec25bdaf60eaf65fedc6.tar.gz
nextcloud-server-79c17cdfa604d73f7f24ec25bdaf60eaf65fedc6.zip
Fix Share::getUsersSharingFile() for mount points
Diffstat (limited to 'lib/private/share')
-rw-r--r--lib/private/share/share.php21
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index c6f7258c536..2125767cabb 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -137,7 +137,7 @@ class Share extends Constants {
$publicShare = false;
$remoteShare = false;
$source = -1;
- $cache = false;
+ $cache = $mountPath = false;
$view = new \OC\Files\View('/' . $ownerUser . '/files');
$meta = $view->getFileInfo($path);
@@ -151,8 +151,14 @@ class Share extends Constants {
if($meta !== false) {
$source = $meta['fileid'];
$cache = new \OC\Files\Cache\Cache($meta['storage']);
+
+ $mountPath = $meta->getMountPoint()->getMountPoint();
+ if ($mountPath !== false) {
+ $mountPath = substr($mountPath, strlen('/' . $ownerUser . '/files'));
+ }
}
+ $paths = [];
while ($source !== -1) {
// Fetch all shares with another user
if (!$returnUserPaths) {
@@ -257,6 +263,7 @@ class Share extends Constants {
// let's get the parent for the next round
$meta = $cache->get((int)$source);
if ($recursive === true && $meta !== false) {
+ $paths[$source] = $meta['path'];
$source = (int)$meta['parent'];
} else {
$source = -1;
@@ -285,9 +292,15 @@ class Share extends Constants {
} else {
while ($row = $result->fetchRow()) {
foreach ($fileTargets[$row['fileid']] as $uid => $shareData) {
- $sharedPath = $shareData['file_target'];
- $sharedPath .= substr($path, strlen($row['path']) -5);
- $sharePaths[$uid] = $sharedPath;
+ if ($mountPath !== false) {
+ $sharedPath = $shareData['file_target'];
+ $sharedPath .= substr($path, strlen($mountPath) + strlen($paths[$row['fileid']]));
+ $sharePaths[$uid] = $sharedPath;
+ } else {
+ $sharedPath = $shareData['file_target'];
+ $sharedPath .= substr($path, strlen($row['path']) -5);
+ $sharePaths[$uid] = $sharedPath;
+ }
}
}
}