aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2014-03-11 12:58:46 +0100
committerBjoern Schiessle <schiessle@owncloud.com>2014-03-25 17:48:50 +0100
commit3653a51af2f21065f7afad40624e053f0dfaadb3 (patch)
tree5b465ee8613623611bc215b31c2375c415422984 /lib
parent2d8607fae92e083a431d476f670acdbc1cfdc947 (diff)
downloadnextcloud-server-3653a51af2f21065f7afad40624e053f0dfaadb3.tar.gz
nextcloud-server-3653a51af2f21065f7afad40624e053f0dfaadb3.zip
fix path creation for re-shares, issue #7662
Diffstat (limited to 'lib')
-rw-r--r--lib/private/share/share.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index ae7b6f5fbc7..e4886abd2b5 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -1087,18 +1087,23 @@ class Share extends \OC\Share\Constants {
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']])) {