From b3d836332720f8e1be7d9392fa76a20733ff5a10 Mon Sep 17 00:00:00 2001 From: Claus-Justus Heine Date: Thu, 3 Feb 2022 08:56:24 +0100 Subject: Prevent the OpenDocument preview generator from trying to open empty files. Rationale: does not make sense, and triggers a deprecation error in \ZipArchive. Signed-off-by: Claus-Justus Heine --- lib/private/Preview/Bundled.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib') diff --git a/lib/private/Preview/Bundled.php b/lib/private/Preview/Bundled.php index df7f630dff7..812385c1672 100644 --- a/lib/private/Preview/Bundled.php +++ b/lib/private/Preview/Bundled.php @@ -31,6 +31,11 @@ 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; -- cgit v1.2.3 From 456679c6fbdfd962a7b8ce2f69be10fd2b2082ba Mon Sep 17 00:00:00 2001 From: Claus-Justus Heine Date: Mon, 14 Feb 2022 23:48:14 +0100 Subject: Update lib/private/Preview/Bundled.php Co-authored-by: Carl Schwan --- lib/private/Preview/Bundled.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/private/Preview/Bundled.php b/lib/private/Preview/Bundled.php index 812385c1672..bbe2fcf30ea 100644 --- a/lib/private/Preview/Bundled.php +++ b/lib/private/Preview/Bundled.php @@ -32,7 +32,7 @@ use OCP\IImage; abstract class Bundled extends ProviderV2 { protected function extractThumbnail(File $file, string $path): ?IImage { - if ($file->getSize() == 0) { + if ($file->getSize() === 0) { return null; } -- cgit v1.2.3 From 800f40b71c65a11034eb4b5d28c7b83fb8687357 Mon Sep 17 00:00:00 2001 From: Simon L Date: Mon, 17 Apr 2023 17:18:09 +0200 Subject: fix php-lint Signed-off-by: Simon L --- lib/private/Preview/Bundled.php | 1 - 1 file changed, 1 deletion(-) (limited to 'lib') diff --git a/lib/private/Preview/Bundled.php b/lib/private/Preview/Bundled.php index bbe2fcf30ea..2a408b90c4e 100644 --- a/lib/private/Preview/Bundled.php +++ b/lib/private/Preview/Bundled.php @@ -31,7 +31,6 @@ use OCP\IImage; */ abstract class Bundled extends ProviderV2 { protected function extractThumbnail(File $file, string $path): ?IImage { - if ($file->getSize() === 0) { return null; } -- cgit v1.2.3