aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/share.php
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2013-03-07 22:30:12 -0500
committerMichael Gapczynski <mtgap@owncloud.com>2013-03-07 22:30:12 -0500
commit6e5e8c6b46f24027ee86284844f43e744a3f5f4c (patch)
tree0be318f5b5fb191fd70bfa9b1cdac06d02ac40c9 /lib/public/share.php
parent0aa6c1b163c582011f695510b0048e31479eb8a4 (diff)
downloadnextcloud-server-6e5e8c6b46f24027ee86284844f43e744a3f5f4c.tar.gz
nextcloud-server-6e5e8c6b46f24027ee86284844f43e744a3f5f4c.zip
Fix #2080 and fix #2141
Diffstat (limited to 'lib/public/share.php')
-rw-r--r--lib/public/share.php25
1 files changed, 15 insertions, 10 deletions
diff --git a/lib/public/share.php b/lib/public/share.php
index 59f41a9bfd6..d1ae0312bf6 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -759,7 +759,7 @@ class Share {
if ($format == self::FORMAT_STATUSES) {
if ($itemType == 'file' || $itemType == 'folder') {
$select = '`*PREFIX*share`.`id`, `item_type`, `*PREFIX*share`.`parent`,'
- .' `share_type`, `file_source`, `path`, `expiration`';
+ .' `share_type`, `file_source`, `path`, `expiration`, `storage`';
} else {
$select = '`id`, `item_type`, `item_source`, `parent`, `share_type`, `expiration`';
}
@@ -768,7 +768,7 @@ class Share {
if ($itemType == 'file' || $itemType == 'folder') {
$select = '`*PREFIX*share`.`id`, `item_type`, `*PREFIX*share`.`parent`,'
.' `share_type`, `share_with`, `file_source`, `path`, `permissions`, `stime`,'
- .' `expiration`, `token`';
+ .' `expiration`, `token`, `storage`';
} else {
$select = '`id`, `item_type`, `item_source`, `parent`, `share_type`, `share_with`, `permissions`,'
.' `stime`, `file_source`, `expiration`, `token`';
@@ -804,6 +804,7 @@ class Share {
$items = array();
$targets = array();
$switchedItems = array();
+ $mounts = array();
while ($row = $result->fetchRow()) {
// Filter out duplicate group shares for users with unique targets
if ($row['share_type'] == self::$shareTypeGroupUserUnique && isset($items[$row['parent']])) {
@@ -848,8 +849,13 @@ class Share {
if (isset($row['parent'])) {
$row['path'] = '/Shared/'.basename($row['path']);
} else {
- // Strip 'files' from path
- $row['path'] = substr($row['path'], 5);
+ if (!isset($mounts[$row['storage']])) {
+ $mounts[$row['storage']] = \OC\Files\Mount::findByNumericId($row['storage']);
+ }
+ if ($mounts[$row['storage']]) {
+ $path = $mounts[$row['storage']]->getMountPoint().$row['path'];
+ $row['path'] = substr($path, $root);
+ }
}
}
if (isset($row['expiration'])) {
@@ -957,15 +963,14 @@ class Share {
return $items;
} else if ($format == self::FORMAT_STATUSES) {
$statuses = array();
- // Switch column to path for files and folders, used for determining statuses inside of folders
- if ($itemType == 'file' || $itemType == 'folder') {
- $column = 'path';
- }
foreach ($items as $item) {
if ($item['share_type'] == self::SHARE_TYPE_LINK) {
- $statuses[$item[$column]] = true;
+ $statuses[$item[$column]]['link'] = true;
} else if (!isset($statuses[$item[$column]])) {
- $statuses[$item[$column]] = false;
+ $statuses[$item[$column]]['link'] = false;
+ }
+ if ($itemType == 'file' || $itemType == 'folder') {
+ $statuses[$item[$column]]['path'] = $item['path'];
}
}
return $statuses;