Merge pull request #32513 from nextcloud/backport/32496/stable24

[stable24] Fix crop condition
This commit is contained in:
Vincent Petry 2022-06-10 15:39:32 +02:00 committed by GitHub
commit 4e870ea41d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -232,9 +232,17 @@ class Generator {
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;
}
}
}