aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Preview/Bundled.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Preview/Bundled.php')
-rw-r--r--lib/private/Preview/Bundled.php28
1 files changed, 8 insertions, 20 deletions
diff --git a/lib/private/Preview/Bundled.php b/lib/private/Preview/Bundled.php
index 063c69ba5dd..6100e8262a4 100644
--- a/lib/private/Preview/Bundled.php
+++ b/lib/private/Preview/Bundled.php
@@ -1,24 +1,8 @@
<?php
+
/**
- * @copyright Copyright (c) 2020 Julius Härtl <jus@bitgrid.net>
- *
- * @author Julius Härtl <jus@bitgrid.net>
- *
- * @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 <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OC\Preview;
@@ -31,6 +15,10 @@ use OCP\IImage;
*/
abstract class Bundled extends ProviderV2 {
protected function extractThumbnail(File $file, string $path): ?IImage {
+ if ($file->getSize() === 0) {
+ return null;
+ }
+
$sourceTmp = \OC::$server->getTempManager()->getTemporaryFile();
$targetTmp = \OC::$server->getTempManager()->getTemporaryFile();
$this->tmpFiles[] = $sourceTmp;
@@ -43,7 +31,7 @@ abstract class Bundled extends ProviderV2 {
$zip = new ZIP($sourceTmp);
$zip->extractFile($path, $targetTmp);
- $image = new \OC_Image();
+ $image = new \OCP\Image();
$image->loadFromFile($targetTmp);
$image->fixOrientation();