summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2013-09-26 11:50:46 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2013-09-26 11:50:46 +0200
commita86c10984a90ba51b8748cb789a93908118c5808 (patch)
tree1fbb1576c973606a57f4f51c0d3997d32a04324f /lib
parentee75a5b134eaa49b54857ea254b5217ea47e0e2f (diff)
downloadnextcloud-server-a86c10984a90ba51b8748cb789a93908118c5808.tar.gz
nextcloud-server-a86c10984a90ba51b8748cb789a93908118c5808.zip
catching NotPermittedException and throw it to the dav client as 403
Diffstat (limited to 'lib')
-rw-r--r--lib/connector/sabre/file.php15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/connector/sabre/file.php b/lib/connector/sabre/file.php
index af9a36931ab..aa4b886429c 100644
--- a/lib/connector/sabre/file.php
+++ b/lib/connector/sabre/file.php
@@ -78,11 +78,16 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
// mark file as partial while uploading (ignored by the scanner)
$partpath = $this->path . '.part';
- $putOkay = $fs->file_put_contents($partpath, $data);
- if ($putOkay === false) {
- \OC_Log::write('webdav', '\OC\Files\Filesystem::file_put_contents() failed', \OC_Log::ERROR);
- $fs->unlink($partpath);
- throw new Sabre_DAV_Exception();
+ try {
+ $putOkay = $fs->file_put_contents($partpath, $data);
+ if ($putOkay === false) {
+ \OC_Log::write('webdav', '\OC\Files\Filesystem::file_put_contents() failed', \OC_Log::ERROR);
+ $fs->unlink($partpath);
+ // because we have no clue about the cause we can only throw back a 500/Internal Server Error
+ throw new Sabre_DAV_Exception();
+ }
+ } catch (\OCP\Files\NotPermittedException $e) {
+ throw new Sabre_DAV_Exception_Forbidden();
}
//detect aborted upload