unlock source file when we cant lock the target in a rename

This commit is contained in:
Robin Appelman 2015-05-22 13:43:44 +02:00
parent 668fafd4d2
commit 437c0b55a6
1 changed files with 7 additions and 1 deletions

View File

@ -49,6 +49,7 @@ use OCP\Files\InvalidCharacterInPathException;
use OCP\Files\InvalidPathException;
use OCP\Files\ReservedWordException;
use OCP\Lock\ILockingProvider;
use OCP\Lock\LockedException;
/**
* Class to provide access to ownCloud filesystem via a "view", and methods for
@ -638,7 +639,12 @@ class View {
$internalPath2 = $mount2->getInternalPath($absolutePath2);
$this->lockFile($path1, ILockingProvider::LOCK_EXCLUSIVE);
$this->lockFile($path2, ILockingProvider::LOCK_EXCLUSIVE);
try {
$this->lockFile($path2, ILockingProvider::LOCK_EXCLUSIVE);
} catch (LockedException $e) {
$this->unlockFile($path1, ILockingProvider::LOCK_EXCLUSIVE);
throw $e;
}
if ($internalPath1 === '' and $mount1 instanceof MoveableMount) {
if ($this->isTargetAllowed($absolutePath2)) {