diff options
author | Robin Appelman <icewind@owncloud.com> | 2015-06-30 13:49:54 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2015-07-15 13:43:34 +0200 |
commit | db21b0964c669425331b5c6faec8aef0d47c3584 (patch) | |
tree | 0275e6ab63966ff3f0cf3f5b2edfedc36283b101 /apps/files_sharing | |
parent | cc45b49de7aa4370eda2405134cc5519c3907854 (diff) | |
download | nextcloud-server-db21b0964c669425331b5c6faec8aef0d47c3584.tar.gz nextcloud-server-db21b0964c669425331b5c6faec8aef0d47c3584.zip |
only lock the parent folders
Diffstat (limited to 'apps/files_sharing')
-rw-r--r-- | apps/files_sharing/lib/sharedstorage.php | 4 | ||||
-rw-r--r-- | apps/files_sharing/tests/locking.php | 11 |
2 files changed, 13 insertions, 2 deletions
diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php index e54f747d3ba..ff01489d77b 100644 --- a/apps/files_sharing/lib/sharedstorage.php +++ b/apps/files_sharing/lib/sharedstorage.php @@ -632,7 +632,7 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage { // lock the parent folders of the owner when locking the share as recipient if ($path === '') { $sourcePath = $this->ownerView->getPath($this->share['file_source']); - $this->ownerView->lockFile($sourcePath, ILockingProvider::LOCK_SHARED, true); + $this->ownerView->lockFile(dirname($sourcePath), ILockingProvider::LOCK_SHARED, true); } } @@ -648,7 +648,7 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage { // unlock the parent folders of the owner when unlocking the share as recipient if ($path === '') { $sourcePath = $this->ownerView->getPath($this->share['file_source']); - $this->ownerView->unlockFile($sourcePath, ILockingProvider::LOCK_SHARED, true); + $this->ownerView->unlockFile(dirname($sourcePath), ILockingProvider::LOCK_SHARED, true); } } diff --git a/apps/files_sharing/tests/locking.php b/apps/files_sharing/tests/locking.php index 46afbf294be..6d13fc1cda5 100644 --- a/apps/files_sharing/tests/locking.php +++ b/apps/files_sharing/tests/locking.php @@ -87,4 +87,15 @@ class Locking extends TestCase { $this->assertTrue(Filesystem::rename('/foo', '/asd')); } + + public function testChangeLock() { + + Filesystem::initMountPoints($this->recipientUid); + $recipientView = new View('/' . $this->recipientUid . '/files'); + $recipientView->lockFile('bar.txt', ILockingProvider::LOCK_SHARED); + $recipientView->changeLock('bar.txt', ILockingProvider::LOCK_EXCLUSIVE); + $recipientView->unlockFile('bar.txt', ILockingProvider::LOCK_EXCLUSIVE); + + $this->assertTrue(true); + } } |