aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2022-05-20 08:08:48 +0200
committerGitHub <noreply@github.com>2022-05-20 08:08:48 +0200
commit818b898df542b01a343c74afb9c4e2fd97c46677 (patch)
tree7d81a32e74c055da79c5ee43b5e2dc54bb96b937
parent17a2b1d3aafce4bd0a9b528d7314b564ff70db1d (diff)
parenta5a4e0df1ca0028fae53d4618e334320d0be64fb (diff)
downloadnextcloud-server-818b898df542b01a343c74afb9c4e2fd97c46677.tar.gz
nextcloud-server-818b898df542b01a343c74afb9c4e2fd97c46677.zip
Merge pull request #32496 from nextcloud/fix/cropp-condition
-rw-r--r--lib/private/Preview/Generator.php15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/private/Preview/Generator.php b/lib/private/Preview/Generator.php
index a19a19ef15f..2edea868ed0 100644
--- a/lib/private/Preview/Generator.php
+++ b/lib/private/Preview/Generator.php
@@ -144,7 +144,6 @@ class Generator {
&& ($specifications[0]['width'] <= 256 || $specifications[0]['height'] <= 256)
&& preg_match(Imaginary::supportedMimeTypes(), $mimeType)
&& $this->config->getSystemValueString('preview_imaginary_url', 'invalid') !== 'invalid') {
-
$crop = $specifications[0]['crop'] ?? false;
$preview = $this->getSmallImagePreview($previewFolder, $file, $mimeType, $previewVersion, $crop);
@@ -233,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;
+ }
}
}