From f56ae37e8fe31afb109889816273c21704361f15 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Fri, 9 Sep 2016 10:58:52 +0200 Subject: Opening the trashbin causes errors in log for files without preview * put a file without a generated preview in the trashbin (e.g. a *.docx file) * open the trashbin * following errors will show up in the nextcloud.log: - filesize(): stat failed for ... - fopen(...): failed to open stream: No such file or directory at ... - fread() expects parameter 1 to be resource, boolean given at ... - fclose() expects parameter 1 to be resource, boolean given at ... - imagecreatefromstring(): Empty string or invalid image at ... This is because the preview code tries to load an SVG image, which is obviously only text. The fix simply handles this before the loading happens and the web UI keeps showing the default mimetype icon. --- lib/private/PreviewNotAvailableException.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 lib/private/PreviewNotAvailableException.php (limited to 'lib/private/PreviewNotAvailableException.php') diff --git a/lib/private/PreviewNotAvailableException.php b/lib/private/PreviewNotAvailableException.php new file mode 100644 index 00000000000..7d92e860629 --- /dev/null +++ b/lib/private/PreviewNotAvailableException.php @@ -0,0 +1,27 @@ + + * + * @author Morris Jobke + * + * @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 OC; + +class PreviewNotAvailableException extends \Exception { +} -- cgit v1.2.3