Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-07-09 16:29:20 +0300
committerMorris Jobke <hey@morrisjobke.de>2015-07-09 16:29:20 +0300
commit3fe4f53a1f25aca930c294bf70d586b70fc440f7 (patch)
tree26bb937da57f85c2f33dc633a40387a29a368fc3 /lib
parentaffe4d7a382a8d8fd6c21ee843ef855c4476e0a1 (diff)
parentc9e77c7de49400234f730147f7cf2b4de140bc2b (diff)
Merge pull request #17326 from owncloud/stable8-catch-notpermitted
[stable8] Properly handle NotPermittedException in SabreDAV
Diffstat (limited to 'lib')
-rw-r--r--lib/private/connector/sabre/file.php11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/private/connector/sabre/file.php b/lib/private/connector/sabre/file.php
index e57d04f9a6e..f29e3620d4a 100644
--- a/lib/private/connector/sabre/file.php
+++ b/lib/private/connector/sabre/file.php
@@ -142,6 +142,11 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements \Sabre\
throw new \Sabre\DAV\Exception('Could not rename part file to final file');
}
}
+ catch (\OCP\Files\NotPermittedException $e) {
+ $this->fileView->unlink($partFilePath);
+ // a more general case - due to whatever reason the content could not be written
+ throw new \Sabre\DAV\Exception\Forbidden($e->getMessage(), $e->getCode(), $e);
+ }
catch (\OCP\Files\LockNotAcquiredException $e) {
// the file is currently being written to by another process
throw new OC_Connector_Sabre_Exception_FileLocked($e->getMessage(), $e->getCode(), $e);
@@ -328,6 +333,12 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements \Sabre\
$info = $this->fileView->getFileInfo($targetPath);
return $info->getEtag();
+ } catch (\OCP\Files\NotPermittedException $e) {
+ if ($needsPartFile) {
+ $this->fileView->unlink($partFile);
+ }
+ // a more general case - due to whatever reason the content could not be written
+ throw new \Sabre\DAV\Exception\Forbidden($e->getMessage(), $e->getCode(), $e);
} catch (\OCP\Files\StorageNotAvailableException $e) {
throw new \Sabre\DAV\Exception\ServiceUnavailable("Failed to put file: ".$e->getMessage());
}