diff options
author | John Molakvoæ <skjnldsv@users.noreply.github.com> | 2022-05-20 08:14:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-20 08:14:17 +0200 |
commit | 87ce03db1ac8f1d7313850128528e5b8f06fce66 (patch) | |
tree | 46b14752c15fc7507d236a1252172c42913a512c | |
parent | 818b898df542b01a343c74afb9c4e2fd97c46677 (diff) | |
parent | 3742b7392dd2e7607223148cee0f7475c4e2732d (diff) | |
download | nextcloud-server-87ce03db1ac8f1d7313850128528e5b8f06fce66.tar.gz nextcloud-server-87ce03db1ac8f1d7313850128528e5b8f06fce66.zip |
Merge pull request #32410 from nextcloud/bugfix/noid/imaginary-exception
-rw-r--r-- | lib/private/Preview/Generator.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/private/Preview/Generator.php b/lib/private/Preview/Generator.php index 2edea868ed0..d52191544f3 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) { @@ -292,6 +295,8 @@ class Generator { return $file; } } + + throw new NotFoundException('No provider successfully handled the preview generation'); } /** |