summaryrefslogtreecommitdiffstats
path: root/lib/private/connector
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/connector')
-rw-r--r--lib/private/connector/sabre/file.php14
-rw-r--r--lib/private/connector/sabre/objecttree.php8
2 files changed, 19 insertions, 3 deletions
diff --git a/lib/private/connector/sabre/file.php b/lib/private/connector/sabre/file.php
index 325206f060b..3e1b29a4f28 100644
--- a/lib/private/connector/sabre/file.php
+++ b/lib/private/connector/sabre/file.php
@@ -46,6 +46,7 @@ use OCP\Files\LockNotAcquiredException;
use OCP\Files\NotPermittedException;
use OCP\Files\StorageNotAvailableException;
use OCP\Lock\ILockingProvider;
+use OCP\Lock\LockedException;
use Sabre\DAV\Exception;
use Sabre\DAV\Exception\BadRequest;
use Sabre\DAV\Exception\Forbidden;
@@ -80,6 +81,7 @@ class File extends Node implements IFile {
* @throws Exception
* @throws EntityTooLarge
* @throws ServiceUnavailable
+ * @throws FileLocked
* @return string|null
*/
public function put($data) {
@@ -111,7 +113,11 @@ class File extends Node implements IFile {
$partFilePath = $this->path;
}
- $this->fileView->lockFile($this->path, ILockingProvider::LOCK_EXCLUSIVE);
+ try {
+ $this->fileView->lockFile($this->path, ILockingProvider::LOCK_EXCLUSIVE);
+ } catch (LockedException $e) {
+ throw new FileLocked($e->getMessage(), $e->getCode(), $e);
+ }
// the part file and target file might be on a different storage in case of a single file storage (e.g. single file share)
/** @var \OC\Files\Storage\Storage $partStorage */
@@ -257,6 +263,8 @@ class File extends Node implements IFile {
throw new ServiceUnavailable("Encryption not ready: " . $e->getMessage());
} catch (StorageNotAvailableException $e) {
throw new ServiceUnavailable("Failed to open file: " . $e->getMessage());
+ } catch (LockedException $e) {
+ throw new FileLocked($e->getMessage(), $e->getCode(), $e);
}
}
@@ -278,6 +286,8 @@ class File extends Node implements IFile {
}
} catch (StorageNotAvailableException $e) {
throw new ServiceUnavailable("Failed to unlink: " . $e->getMessage());
+ } catch (LockedException $e) {
+ throw new FileLocked($e->getMessage(), $e->getCode(), $e);
}
}
@@ -383,6 +393,8 @@ class File extends Node implements IFile {
return $info->getEtag();
} catch (StorageNotAvailableException $e) {
throw new ServiceUnavailable("Failed to put file: " . $e->getMessage());
+ } catch (LockedException $e) {
+ throw new FileLocked($e->getMessage(), $e->getCode(), $e);
}
}
diff --git a/lib/private/connector/sabre/objecttree.php b/lib/private/connector/sabre/objecttree.php
index 17d9aff8f68..ed42a31336a 100644
--- a/lib/private/connector/sabre/objecttree.php
+++ b/lib/private/connector/sabre/objecttree.php
@@ -26,10 +26,12 @@
namespace OC\Connector\Sabre;
use OC\Connector\Sabre\Exception\InvalidPath;
+use OC\Connector\Sabre\Exception\FileLocked;
use OC\Files\FileInfo;
use OC\Files\Mount\MoveableMount;
use OCP\Files\StorageInvalidException;
use OCP\Files\StorageNotAvailableException;
+use OCP\Lock\LockedException;
class ObjectTree extends \Sabre\DAV\Tree {
@@ -221,8 +223,10 @@ class ObjectTree extends \Sabre\DAV\Tree {
if (!$renameOkay) {
throw new \Sabre\DAV\Exception\Forbidden('');
}
- } catch (\OCP\Files\StorageNotAvailableException $e) {
+ } catch (StorageNotAvailableException $e) {
throw new \Sabre\DAV\Exception\ServiceUnavailable($e->getMessage());
+ } catch (LockedException $e) {
+ throw new FileLocked($e->getMessage(), $e->getCode(), $e);
}
$this->markDirty($sourceDir);
@@ -258,7 +262,7 @@ class ObjectTree extends \Sabre\DAV\Tree {
try {
$this->fileView->copy($source, $destination);
- } catch (\OCP\Files\StorageNotAvailableException $e) {
+ } catch (StorageNotAvailableException $e) {
throw new \Sabre\DAV\Exception\ServiceUnavailable($e->getMessage());
}