summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2015-06-29 11:54:56 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2015-06-30 15:08:18 +0200
commit44ec3dd110a86c5654ad5a199476bec0c56f7419 (patch)
tree51ecc2211c4b1ff82230f3518653eac310131089 /lib
parentb55f71ee032a77105b823ee01653f39fe066977f (diff)
downloadnextcloud-server-44ec3dd110a86c5654ad5a199476bec0c56f7419.tar.gz
nextcloud-server-44ec3dd110a86c5654ad5a199476bec0c56f7419.zip
if it is a mount point we need to get the path from the mount manager
Diffstat (limited to 'lib')
-rw-r--r--lib/private/share/share.php22
1 files changed, 19 insertions, 3 deletions
diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index 71390d99966..af7f78b9ff5 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -372,6 +372,22 @@ class Share extends Constants {
if ($fileDependent && !self::isFileReachable($row['path'], $row['storage_id'])) {
continue;
}
+ if ($fileDependent && (int)$row['file_parent'] === -1) {
+ // if it is a mount point we need to get the path from the mount manager
+ $mountManager = \OC\Files\Filesystem::getMountManager();
+ $mountPoint = $mountManager->findByStorageId($row['storage_id']);
+ if (!empty($mountPoint)) {
+ $path = $mountPoint[0]->getMountPoint();
+ $path = trim($path, '/');
+ $path = substr($path, strlen($owner) + 1); //normalize path to 'files/foo.txt`
+ $row['path'] = $path;
+ } else {
+ \OC::$server->getLogger()->warning(
+ 'Could not resolve mount point for ' . $row['storage_id'],
+ ['app' => 'OCP\Share']
+ );
+ }
+ }
$shares[] = $row;
}
@@ -2290,7 +2306,7 @@ class Share extends Constants {
if ($fileDependent) {
$select = '`*PREFIX*share`.`id`, `*PREFIX*share`.`parent`, `share_type`, `path`, `storage`, '
. '`share_with`, `uid_owner` , `file_source`, `stime`, `*PREFIX*share`.`permissions`, '
- . '`*PREFIX*storages`.`id` AS `storage_id`';
+ . '`*PREFIX*storages`.`id` AS `storage_id`, `*PREFIX*filecache`.`parent` as `file_parent`';
} else {
$select = '`id`, `parent`, `share_type`, `share_with`, `uid_owner`, `item_source`, `stime`, `*PREFIX*share`.`permissions`';
}
@@ -2300,7 +2316,7 @@ class Share extends Constants {
$select = '`*PREFIX*share`.`id`, `item_type`, `item_source`, `*PREFIX*share`.`parent`,'
. ' `share_type`, `share_with`, `file_source`, `file_target`, `path`, `*PREFIX*share`.`permissions`, `stime`,'
. ' `expiration`, `token`, `storage`, `mail_send`, `uid_owner`, '
- . '`*PREFIX*storages`.`id` AS `storage_id`';
+ . '`*PREFIX*storages`.`id` AS `storage_id`, `*PREFIX*filecache`.`parent` as `file_parent`';
} else {
$select = '`id`, `item_type`, `item_source`, `parent`, `share_type`, `share_with`, `*PREFIX*share`.`permissions`,'
. ' `stime`, `file_source`, `expiration`, `token`, `mail_send`, `uid_owner`';
@@ -2317,7 +2333,7 @@ class Share extends Constants {
. '`*PREFIX*share`.`parent`, `share_type`, `share_with`, `uid_owner`,'
. '`file_source`, `path`, `file_target`, `*PREFIX*share`.`permissions`,'
. '`stime`, `expiration`, `token`, `storage`, `mail_send`,'
- . '`*PREFIX*storages`.`id` AS `storage_id`';
+ . '`*PREFIX*storages`.`id` AS `storage_id`, `*PREFIX*filecache`.`parent` as `file_parent`';
}
}
}