diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-02-25 18:28:21 +0400 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-02-26 18:22:20 +0400 |
commit | b4f154f9b4e76ac237c66705ffb9b5ab976352ee (patch) | |
tree | afe50b5df2f0b4276c119cc216ff97971e884443 /lib | |
parent | ac3f1d6f61fcdb9e9602cc0d7fd521a10757fdb7 (diff) |
fix path in sharing results if it is a file in the Shared folder
Diffstat (limited to 'lib')
-rw-r--r-- | lib/public/share.php | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/public/share.php b/lib/public/share.php index ae7d29e8b87..c23ab086329 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -1241,7 +1241,21 @@ class Share { // Remove root from file source paths if retrieving own shared items if (isset($uidOwner) && isset($row['path'])) { if (isset($row['parent'])) { - $row['path'] = '/Shared/'.basename($row['path']); + $query = \OC_DB::prepare('SELECT `file_target` FROM `*PREFIX*share` WHERE `id` = ?'); + $parentResult = $query->execute(array($row['parent'])); + if (\OC_DB::isError($result)) { + \OC_Log::write('OCP\Share', 'Can\'t select parent: ' . + \OC_DB::getErrorMessage($result) . ', select=' . $select . ' where=' . $where, + \OC_Log::ERROR); + } else { + $parentRow = $parentResult->fetchRow(); + $splitPath = explode('/', $row['path']); + $tmpPath = '/Shared' . $parentRow['file_target']; + foreach (array_slice($splitPath, 2) as $pathPart) { + $tmpPath = $tmpPath . '/' . $pathPart; + } + $row['path'] = $tmpPath; + } } else { if (!isset($mounts[$row['storage']])) { $mountPoints = \OC\Files\Filesystem::getMountByNumericId($row['storage']); |