catch specific file exceptions and convert them to proper http status code via webdav
This commit is contained in:
parent
7c6ed6ab33
commit
caa27824a9
|
@ -87,14 +87,21 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
|
||||||
throw new Sabre_DAV_Exception();
|
throw new Sabre_DAV_Exception();
|
||||||
}
|
}
|
||||||
} catch (\OCP\Files\NotPermittedException $e) {
|
} catch (\OCP\Files\NotPermittedException $e) {
|
||||||
throw new Sabre_DAV_Exception_Forbidden();
|
// a more general case - due to whatever reason the content could not be written
|
||||||
|
throw new Sabre_DAV_Exception_Forbidden($e->getMessage());
|
||||||
|
|
||||||
} catch (\OCP\Files\EntityTooLargeException $e) {
|
} catch (\OCP\Files\EntityTooLargeException $e) {
|
||||||
throw new OC_Connector_Sabre_Exception_EntityTooLarge();
|
// the file is too big to be stored
|
||||||
|
throw new OC_Connector_Sabre_Exception_EntityTooLarge($e->getMessage());
|
||||||
|
|
||||||
} catch (\OCP\Files\InvalidContentException $e) {
|
} catch (\OCP\Files\InvalidContentException $e) {
|
||||||
throw new OC_Connector_Sabre_Exception_UnsupportedMediaType();
|
// the file content is not permitted
|
||||||
|
throw new OC_Connector_Sabre_Exception_UnsupportedMediaType($e->getMessage());
|
||||||
|
|
||||||
} catch (\OCP\Files\InvalidPathException $e) {
|
} catch (\OCP\Files\InvalidPathException $e) {
|
||||||
// TODO: add specific exception here
|
// the path for the file was not valid
|
||||||
throw new Sabre_DAV_Exception_Forbidden();
|
// TODO: find proper http status code for this case
|
||||||
|
throw new Sabre_DAV_Exception_Forbidden($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
// rename to correct path
|
// rename to correct path
|
||||||
|
|
Loading…
Reference in New Issue