diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2013-10-08 15:04:31 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2013-10-08 15:04:31 +0200 |
commit | caa27824a94e3af757ea33b01b5682ef963ae714 (patch) | |
tree | 28b95f57ebf5f709f995263b7eceb91acbddec4a /lib/private/connector | |
parent | 7c6ed6ab33e8487d6de135b5e956a82685bf4463 (diff) | |
download | nextcloud-server-caa27824a94e3af757ea33b01b5682ef963ae714.tar.gz nextcloud-server-caa27824a94e3af757ea33b01b5682ef963ae714.zip |
catch specific file exceptions and convert them to proper http status code via webdav
Diffstat (limited to 'lib/private/connector')
-rw-r--r-- | lib/private/connector/sabre/file.php | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/private/connector/sabre/file.php b/lib/private/connector/sabre/file.php index 3c19da7c618..84154ee855a 100644 --- a/lib/private/connector/sabre/file.php +++ b/lib/private/connector/sabre/file.php @@ -87,14 +87,21 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D throw new Sabre_DAV_Exception(); } } 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) { - 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) { - 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) { - // TODO: add specific exception here - throw new Sabre_DAV_Exception_Forbidden(); + // the path for the file was not valid + // TODO: find proper http status code for this case + throw new Sabre_DAV_Exception_Forbidden($e->getMessage()); } // rename to correct path |