diff options
author | Morris Jobke <hey@morrisjobke.de> | 2015-07-09 15:29:20 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-07-09 15:29:20 +0200 |
commit | 3fe4f53a1f25aca930c294bf70d586b70fc440f7 (patch) | |
tree | 26bb937da57f85c2f33dc633a40387a29a368fc3 /lib | |
parent | affe4d7a382a8d8fd6c21ee843ef855c4476e0a1 (diff) | |
parent | c9e77c7de49400234f730147f7cf2b4de140bc2b (diff) | |
download | nextcloud-server-3fe4f53a1f25aca930c294bf70d586b70fc440f7.tar.gz nextcloud-server-3fe4f53a1f25aca930c294bf70d586b70fc440f7.zip |
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.php | 11 |
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()); } |