diff options
author | Vincent Petry <vincent@nextcloud.com> | 2022-06-10 16:39:32 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-10 16:39:32 +0300 |
commit | 4e870ea41d96be97ba8dfebfb3a49d6720108289 (patch) | |
tree | 84797949e3f1968ad2aaeedcc93d06c31383ae13 | |
parent | ddac16b6ec35c5f714ff366979e141ba3f2181eb (diff) | |
parent | 634a15ab71c00974e5709cebac8a48c8478743a2 (diff) |
Merge pull request #32513 from nextcloud/backport/32496/stable24
[stable24] Fix crop condition
-rw-r--r-- | lib/private/Preview/Generator.php | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/private/Preview/Generator.php b/lib/private/Preview/Generator.php index e058a15bfa5..f9985bc299d 100644 --- a/lib/private/Preview/Generator.php +++ b/lib/private/Preview/Generator.php @@ -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; + } } } |