catching NotPermittedException and throw it to the dav client as 403
This commit is contained in:
parent
ee75a5b134
commit
a86c10984a
|
@ -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)
|
// mark file as partial while uploading (ignored by the scanner)
|
||||||
$partpath = $this->path . '.part';
|
$partpath = $this->path . '.part';
|
||||||
|
|
||||||
$putOkay = $fs->file_put_contents($partpath, $data);
|
try {
|
||||||
if ($putOkay === false) {
|
$putOkay = $fs->file_put_contents($partpath, $data);
|
||||||
\OC_Log::write('webdav', '\OC\Files\Filesystem::file_put_contents() failed', \OC_Log::ERROR);
|
if ($putOkay === false) {
|
||||||
$fs->unlink($partpath);
|
\OC_Log::write('webdav', '\OC\Files\Filesystem::file_put_contents() failed', \OC_Log::ERROR);
|
||||||
throw new Sabre_DAV_Exception();
|
$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
|
//detect aborted upload
|
||||||
|
|
Loading…
Reference in New Issue