Merge pull request #19615 from owncloud/issue-15858-mount-points-return-wrong-paths-for-getusersharingfiles
Fix Share::getUsersSharingFile() for mount points
This commit is contained in:
commit
dfb98c31a3
|
@ -137,7 +137,7 @@ class Share extends Constants {
|
||||||
$publicShare = false;
|
$publicShare = false;
|
||||||
$remoteShare = false;
|
$remoteShare = false;
|
||||||
$source = -1;
|
$source = -1;
|
||||||
$cache = false;
|
$cache = $mountPath = false;
|
||||||
|
|
||||||
$view = new \OC\Files\View('/' . $ownerUser . '/files');
|
$view = new \OC\Files\View('/' . $ownerUser . '/files');
|
||||||
$meta = $view->getFileInfo($path);
|
$meta = $view->getFileInfo($path);
|
||||||
|
@ -151,8 +151,14 @@ class Share extends Constants {
|
||||||
if($meta !== false) {
|
if($meta !== false) {
|
||||||
$source = $meta['fileid'];
|
$source = $meta['fileid'];
|
||||||
$cache = new \OC\Files\Cache\Cache($meta['storage']);
|
$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) {
|
while ($source !== -1) {
|
||||||
// Fetch all shares with another user
|
// Fetch all shares with another user
|
||||||
if (!$returnUserPaths) {
|
if (!$returnUserPaths) {
|
||||||
|
@ -257,6 +263,7 @@ class Share extends Constants {
|
||||||
// let's get the parent for the next round
|
// let's get the parent for the next round
|
||||||
$meta = $cache->get((int)$source);
|
$meta = $cache->get((int)$source);
|
||||||
if ($recursive === true && $meta !== false) {
|
if ($recursive === true && $meta !== false) {
|
||||||
|
$paths[$source] = $meta['path'];
|
||||||
$source = (int)$meta['parent'];
|
$source = (int)$meta['parent'];
|
||||||
} else {
|
} else {
|
||||||
$source = -1;
|
$source = -1;
|
||||||
|
@ -285,9 +292,15 @@ class Share extends Constants {
|
||||||
} else {
|
} else {
|
||||||
while ($row = $result->fetchRow()) {
|
while ($row = $result->fetchRow()) {
|
||||||
foreach ($fileTargets[$row['fileid']] as $uid => $shareData) {
|
foreach ($fileTargets[$row['fileid']] as $uid => $shareData) {
|
||||||
$sharedPath = $shareData['file_target'];
|
if ($mountPath !== false) {
|
||||||
$sharedPath .= substr($path, strlen($row['path']) -5);
|
$sharedPath = $shareData['file_target'];
|
||||||
$sharePaths[$uid] = $sharedPath;
|
$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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue