Skip to content

Commit

Permalink
Merge pull request #32513 from nextcloud/backport/32496/stable24
Browse files Browse the repository at this point in the history
[stable24] Fix crop condition
  • Loading branch information
PVince81 committed Jun 10, 2022
2 parents ddac16b + 634a15a commit 4e870ea
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions lib/private/Preview/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,17 @@ private function getSmallImagePreview(ISimpleFolder $previewFolder, File $file,

foreach ($nodes as $node) {
$name = $node->getName();
if (($prefix === '' || strpos($name, $prefix) === 0)
&& (str_starts_with($name, '256-256-crop') && $crop || str_starts_with($name, '256-256') && !$crop)) {
return $node;
if (($prefix === '' || str_starts_with($name, $prefix))) {
// Prefix match
if (str_starts_with($name, $prefix . '256-256-crop') && $crop) {
// Cropped image
return $node;
}

if (str_starts_with($name, $prefix . '256-256.') && !$crop) {
// Uncropped image
return $node;
}
}
}

Expand Down

0 comments on commit 4e870ea

Please sign in to comment.