From 53447ae2b2066d751b2a998c3ed0a2692c72f6c4 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Thu, 8 Mar 2018 21:58:11 +0100 Subject: Throw an exception if file_put_contents fails * This will help with AppData hardening etc * Introduced a GenericFileException for if nothing else is appropiate - Maybe the other File exceptions should base on this? Signed-off-by: Roeland Jago Douma --- lib/public/Files/File.php | 2 +- lib/public/Files/GenericFileException.php | 33 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 lib/public/Files/GenericFileException.php (limited to 'lib/public/Files') diff --git a/lib/public/Files/File.php b/lib/public/Files/File.php index 8b57b3cfd87..0f052bc66ad 100644 --- a/lib/public/Files/File.php +++ b/lib/public/Files/File.php @@ -53,7 +53,7 @@ interface File extends Node { * * @param string $data * @throws \OCP\Files\NotPermittedException - * @return void + * @throws \OCP\Files\GenericFileException * @since 6.0.0 */ public function putContent($data); diff --git a/lib/public/Files/GenericFileException.php b/lib/public/Files/GenericFileException.php new file mode 100644 index 00000000000..b5da4aabebd --- /dev/null +++ b/lib/public/Files/GenericFileException.php @@ -0,0 +1,33 @@ + + * + * @author Roeland Jago Douma + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ +namespace OCP\Files; + +/** + * Class GenericFileException + * + * @package OCP\Files + * @since 14.0.0 + */ +class GenericFileException extends \Exception { + +} -- cgit v1.2.3