Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2022-05-16 09:28:16 +0300
committerCarl Schwan <carl@carlschwan.eu>2022-05-19 18:01:01 +0300
commit3742b7392dd2e7607223148cee0f7475c4e2732d (patch)
tree439d3b303976571582a453fe9cd8ac27e800178a
parent5a80df6e4c301bc083f7bb20af594783f1b26a97 (diff)
Add explicit return if getSmallImagePreview failsbugfix/noid/imaginary-exception
Signed-off-by: Julius Härtl <jus@bitgrid.net>
-rw-r--r--lib/private/Preview/Generator.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/private/Preview/Generator.php b/lib/private/Preview/Generator.php
index e058a15bfa5..311b012d904 100644
--- a/lib/private/Preview/Generator.php
+++ b/lib/private/Preview/Generator.php
@@ -115,7 +115,7 @@ class Generator {
* Generates previews of a file
*
* @param File $file
- * @param array $specifications
+ * @param non-empty-array $specifications
* @param string $mimeType
* @return ISimpleFile the last preview that was generated
* @throws NotFoundException
@@ -213,6 +213,7 @@ class Generator {
throw new NotFoundException('Cached preview size 0, invalid!');
}
}
+ assert($preview !== null);
// Free memory being used by the embedded image resource. Without this the image is kept in memory indefinitely.
// Garbage Collection does NOT free this memory. We have to do it ourselves.
@@ -226,8 +227,10 @@ class Generator {
/**
* Generate a small image straight away without generating a max preview first
* Preview generated is 256x256
+ *
+ * @throws NotFoundException
*/
- private function getSmallImagePreview(ISimpleFolder $previewFolder, File $file, string $mimeType, string $prefix, bool $crop) {
+ private function getSmallImagePreview(ISimpleFolder $previewFolder, File $file, string $mimeType, string $prefix, bool $crop): ISimpleFile {
$nodes = $previewFolder->getDirectoryListing();
foreach ($nodes as $node) {
@@ -284,6 +287,8 @@ class Generator {
return $file;
}
}
+
+ throw new NotFoundException('No provider successfully handled the preview generation');
}
/**