From fac7ec3fc445ed528d84b258717e856e3638d734 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Thu, 2 Apr 2015 12:03:37 +0200 Subject: [PATCH] fix re-shares with encryption --- apps/files_sharing/tests/testcase.php | 2 +- lib/private/encryption/update.php | 8 ++++++-- lib/private/encryption/util.php | 6 +++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/apps/files_sharing/tests/testcase.php b/apps/files_sharing/tests/testcase.php index 69f68f7dfe..b9f8658a69 100644 --- a/apps/files_sharing/tests/testcase.php +++ b/apps/files_sharing/tests/testcase.php @@ -157,7 +157,7 @@ abstract class TestCase extends \Test\TestCase { $storage = new \ReflectionClass('\OC\Files\Storage\Shared'); $isInitialized = $storage->getProperty('isInitialized'); $isInitialized->setAccessible(true); - $isInitialized->setValue(false); + $isInitialized->setValue(array()); $isInitialized->setAccessible(false); } diff --git a/lib/private/encryption/update.php b/lib/private/encryption/update.php index e838e87050..1cfe935e58 100644 --- a/lib/private/encryption/update.php +++ b/lib/private/encryption/update.php @@ -94,7 +94,11 @@ class Update { */ private function update($fileSource) { $path = \OC\Files\Filesystem::getPath($fileSource); - $absPath = '/' . $this->uid . '/files' . $path; + $info = \OC\Files\Filesystem::getFileInfo($path); + $owner = \OC\Files\Filesystem::getOwner($path); + $view = new \OC\Files\View('/' . $owner . '/files'); + $ownerPath = $view->getPath($info->getId()); + $absPath = '/' . $owner . '/files' . $ownerPath; $mount = $this->mountManager->find($path); $mountPoint = $mount->getMountPoint(); @@ -110,7 +114,7 @@ class Update { foreach ($allFiles as $path) { $usersSharing = $this->file->getAccessList($path); - $encryptionModule->update($absPath, $this->uid, $usersSharing); + $encryptionModule->update($path, $this->uid, $usersSharing); } } diff --git a/lib/private/encryption/util.php b/lib/private/encryption/util.php index e2c7fa26e6..54d587715b 100644 --- a/lib/private/encryption/util.php +++ b/lib/private/encryption/util.php @@ -180,11 +180,11 @@ class Util { foreach ($content as $c) { // getDirectoryContent() returns the paths relative to the mount points, so we need // to re-construct the complete path - $path = ($mountPoint !== '') ? $mountPoint . '/' . $c['path'] : $c['path']; + $path = ($mountPoint !== '') ? $mountPoint . '/' . $c->getPath() : $c->getPath(); if ($c['type'] === 'dir') { - $dirList[] = $path; + $dirList[] = \OC\Files\Filesystem::normalizePath($path); } else { - $result[] = $path; + $result[] = \OC\Files\Filesystem::normalizePath($path); } }