Browse Source
pass the existing locks info when making locked exception with absolute paths
Signed-off-by: Robin Appelman <robin@icewind.nl>
pull/19746/head
Robin Appelman
6 years ago
No known key found for this signature in database
GPG Key ID: 42B69D8A64526EFB
3 changed files with
20 additions and
5 deletions
-
apps/dav/lib/Connector/Sabre/File.php
-
lib/private/Files/View.php
-
lib/public/Lock/LockedException.php
|
|
|
@ -263,7 +263,7 @@ class File extends Node implements IFile { |
|
|
|
|
|
|
|
try { |
|
|
|
$this->acquireLock(ILockingProvider::LOCK_EXCLUSIVE); |
|
|
|
} catch (LockedException $e) { |
|
|
|
} catch (LockedException $ex) { |
|
|
|
if ($needsPartFile) { |
|
|
|
$partStorage->unlink($internalPartPath); |
|
|
|
} |
|
|
|
|
|
|
|
@ -1946,7 +1946,8 @@ class View { |
|
|
|
// rethrow with the a human-readable path
|
|
|
|
throw new LockedException( |
|
|
|
$this->getPathRelativeToFiles($absolutePath), |
|
|
|
$e |
|
|
|
$e, |
|
|
|
$e->getExistingLock() |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1988,12 +1989,14 @@ class View { |
|
|
|
// rethrow with the a human-readable path
|
|
|
|
throw new LockedException( |
|
|
|
$this->getPathRelativeToFiles($absolutePath), |
|
|
|
$e |
|
|
|
$e, |
|
|
|
$e->getExistingLock() |
|
|
|
); |
|
|
|
} catch (\InvalidArgumentException $e) { |
|
|
|
} catch (\InvalidArgumentException $ex) { |
|
|
|
throw new LockedException( |
|
|
|
$absolutePath, |
|
|
|
$e |
|
|
|
$ex, |
|
|
|
$e->getExistingLock() |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -44,6 +44,9 @@ class LockedException extends \Exception { |
|
|
|
*/ |
|
|
|
private $path; |
|
|
|
|
|
|
|
/** @var string|null */ |
|
|
|
private $existingLock; |
|
|
|
|
|
|
|
/** |
|
|
|
* LockedException constructor. |
|
|
|
* |
|
|
|
@ -54,6 +57,7 @@ class LockedException extends \Exception { |
|
|
|
*/ |
|
|
|
public function __construct(string $path, \Exception $previous = null, string $existingLock = null) { |
|
|
|
$message = '"' . $path . '" is locked'; |
|
|
|
$this->existingLock = $existingLock; |
|
|
|
if ($existingLock) { |
|
|
|
$message .= ', existing lock on file: ' . $existingLock; |
|
|
|
} |
|
|
|
@ -68,4 +72,12 @@ class LockedException extends \Exception { |
|
|
|
public function getPath(): string { |
|
|
|
return $this->path; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @return string |
|
|
|
* @since 19.0.0 |
|
|
|
*/ |
|
|
|
public function getExistingLock(): ?string { |
|
|
|
return $this->existingLock; |
|
|
|
} |
|
|
|
} |