only lock the parent folders

This commit is contained in:
Robin Appelman 2015-06-30 13:49:54 +02:00
parent d6f56ea609
commit 3c0be7d126
2 changed files with 13 additions and 2 deletions

View File

@ -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);
}
}

View File

@ -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);
}
}