summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2013-09-24 14:25:56 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2013-09-24 14:25:56 +0200
commitcf9dbc6e349bc287a414547944fd2a6dff383d64 (patch)
treede51b64a4a8957cac57540736bc4468295052ea9
parent40871bab88159d914cfab2dd938a2312ed8eb1c1 (diff)
downloadnextcloud-server-cf9dbc6e349bc287a414547944fd2a6dff383d64.tar.gz
nextcloud-server-cf9dbc6e349bc287a414547944fd2a6dff383d64.zip
adding error handling on file_put_contents within the web dav implementation
-rw-r--r--lib/connector/sabre/directory.php7
-rw-r--r--lib/connector/sabre/file.php7
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/connector/sabre/directory.php b/lib/connector/sabre/directory.php
index 3181a4b310f..0717d952268 100644
--- a/lib/connector/sabre/directory.php
+++ b/lib/connector/sabre/directory.php
@@ -72,7 +72,12 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
// mark file as partial while uploading (ignored by the scanner)
$partpath = $newPath . '.part';
- \OC\Files\Filesystem::file_put_contents($partpath, $data);
+ $putOkay = \OC\Files\Filesystem::file_put_contents($partpath, $data);
+ if ($putOkay === false) {
+ \OC_Log::write('webdav', '\OC\Files\Filesystem::file_put_contents() failed', \OC_Log::ERROR);
+ \OC\Files\Filesystem::unlink($partpath);
+ throw new Sabre_DAV_Exception();
+ }
//detect aborted upload
if (isset ($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'PUT' ) {
diff --git a/lib/connector/sabre/file.php b/lib/connector/sabre/file.php
index 61bdcd5e0ae..57ba94c7b19 100644
--- a/lib/connector/sabre/file.php
+++ b/lib/connector/sabre/file.php
@@ -58,7 +58,12 @@ 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';
- \OC\Files\Filesystem::file_put_contents($partpath, $data);
+ $putOkay = \OC\Files\Filesystem::file_put_contents($partpath, $data);
+ if ($putOkay === false) {
+ \OC_Log::write('webdav', '\OC\Files\Filesystem::file_put_contents() failed', \OC_Log::ERROR);
+ \OC\Files\Filesystem::unlink($partpath);
+ throw new Sabre_DAV_Exception();
+ }
//detect aborted upload
if (isset ($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'PUT') {