diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-03-11 12:58:46 +0100 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-03-11 17:15:56 +0100 |
commit | c3c255b0ca48b71f5cd53e442b570db8b1c66acd (patch) | |
tree | ce5218e55380218a9049eaaafdb819c890f84935 /lib/public | |
parent | 2e42b0555a3cd05a132e25d63282ba5443bf12ee (diff) | |
download | nextcloud-server-c3c255b0ca48b71f5cd53e442b570db8b1c66acd.tar.gz nextcloud-server-c3c255b0ca48b71f5cd53e442b570db8b1c66acd.zip |
fix path creation for re-shares, issue #7662
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/share.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/public/share.php b/lib/public/share.php index c23ab086329..5ed93ea44c5 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -1243,18 +1243,23 @@ class Share { if (isset($row['parent'])) { $query = \OC_DB::prepare('SELECT `file_target` FROM `*PREFIX*share` WHERE `id` = ?'); $parentResult = $query->execute(array($row['parent'])); + //$query = \OC_DB::prepare('SELECT `file_target` FROM `*PREFIX*share` WHERE `id` = ?'); + //$parentResult = $query->execute(array($row['id'])); 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']; + // find the right position where the row path continues from the target path + $pos = strrpos($row['path'], $parentRow['file_target']); + $subPath = substr($row['path'], $pos); + $splitPath = explode('/', $subPath); foreach (array_slice($splitPath, 2) as $pathPart) { $tmpPath = $tmpPath . '/' . $pathPart; } - $row['path'] = $tmpPath; + $row['path'] = $tmpPath; } } else { if (!isset($mounts[$row['storage']])) { |