diff options
author | Robin Appelman <icewind@owncloud.com> | 2015-05-22 13:43:44 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2015-06-01 13:22:56 +0200 |
commit | 437c0b55a625ce3c2c6a81740fda8cb7a0bf1998 (patch) | |
tree | 56efaee2b5f0aedb622c766d95a1f31c81a7f24a | |
parent | 668fafd4d2e56ee47ec67ba0a9768b7e5c3ccafd (diff) | |
download | nextcloud-server-437c0b55a625ce3c2c6a81740fda8cb7a0bf1998.tar.gz nextcloud-server-437c0b55a625ce3c2c6a81740fda8cb7a0bf1998.zip |
unlock source file when we cant lock the target in a rename
-rw-r--r-- | lib/private/files/view.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/private/files/view.php b/lib/private/files/view.php index db904e57cb9..d6cc62dff27 100644 --- a/lib/private/files/view.php +++ b/lib/private/files/view.php @@ -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)) { |