diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-03-11 12:58:46 +0100 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-03-11 12:58:46 +0100 |
commit | 36885dc64ced99737b3eff49a623494ec3bc9e92 (patch) | |
tree | 569d6a540f69019746a262276747d4d928b5732a /lib/public/share.php | |
parent | 23eeb898a97933ebb61b5e325c8ab99a2e3c1596 (diff) | |
download | nextcloud-server-36885dc64ced99737b3eff49a623494ec3bc9e92.tar.gz nextcloud-server-36885dc64ced99737b3eff49a623494ec3bc9e92.zip |
fix path creation for re-shares, issue #7662
Diffstat (limited to 'lib/public/share.php')
-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 2fed41488ca..dd9e1bbf9a9 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -1252,18 +1252,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']])) { |