diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-02-25 15:28:21 +0100 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-02-25 17:27:23 +0100 |
commit | e3f676e00982458d9f04ce0b71e60a273f3d67c3 (patch) | |
tree | 8433045569ad32b07cd4e12a3de2933d438dd790 /lib | |
parent | 9b4af31bac977cb788a6f4a013d32ba0a21437f0 (diff) | |
download | nextcloud-server-e3f676e00982458d9f04ce0b71e60a273f3d67c3.tar.gz nextcloud-server-e3f676e00982458d9f04ce0b71e60a273f3d67c3.zip |
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 ebc555dba5f..2fed41488ca 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -1250,7 +1250,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']); |