Bladeren bron

Add explicit return if getSmallImagePreview fails

Signed-off-by: Julius Härtl <jus@bitgrid.net>
tags/v25.0.0beta1
Julius Härtl 2 jaren geleden
bovenliggende
commit
3742b7392d
1 gewijzigde bestanden met toevoegingen van 7 en 2 verwijderingen
  1. 7
    2
      lib/private/Preview/Generator.php

+ 7
- 2
lib/private/Preview/Generator.php Bestand weergeven

* Generates previews of a file * Generates previews of a file
* *
* @param File $file * @param File $file
* @param array $specifications
* @param non-empty-array $specifications
* @param string $mimeType * @param string $mimeType
* @return ISimpleFile the last preview that was generated * @return ISimpleFile the last preview that was generated
* @throws NotFoundException * @throws NotFoundException
throw new NotFoundException('Cached preview size 0, invalid!'); 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. // 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. // Garbage Collection does NOT free this memory. We have to do it ourselves.
/** /**
* Generate a small image straight away without generating a max preview first * Generate a small image straight away without generating a max preview first
* Preview generated is 256x256 * 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(); $nodes = $previewFolder->getDirectoryListing();


foreach ($nodes as $node) { foreach ($nodes as $node) {
return $file; return $file;
} }
} }

throw new NotFoundException('No provider successfully handled the preview generation');
} }


/** /**

Laden…
Annuleren
Opslaan