Repository: pimcore/pimcore (language: php)

Issue:
[Bug]: Unable to generate thumbnail in ORIGINAL format
### Pimcore version

11.2.3.2

### Steps to reproduce

1. Create a thumbnail definition
2. Set "Format" to `ORIGINAL` (and, for easier reproduction, enable "List as option in download section on image detail view")
3. Upload a JPG image
4. Generate a thumbnail e.g. by selecting that definition in the asset module and clicking "Download"

Note: `pimcore.assets.thumbnails.allowed_formats` as described at https://pimcore.com/docs/platform/Pimcore/Installation_and_Upgrade/Upgrade_Notes/#pimcore-1124--11231--11165 is left untouched i.e. `JPG` (or any variations thereof) should work.

### Actual Behavior

1. HTTP 500

Please note: this is currently only reproducible on the Enterprise demo which uses v11.2.3.2 and not on the Community demo which is on v11.2.3 as the corresponding change introduced in a6821a16ea38086bf6012e682e1743488244bd85 is not yet tagged as a non-Enterprise version (see also https://github.com/pimcore/pimcore/compare/v11.2.3...11.x).

### Expected Behavior

1. Thumbnail is downloaded in the original format

The bug is due to https://github.com/pimcore/pimcore/commit/a6821a16ea38086bf6012e682e1743488244bd85#diff-b48489e5be12fb4a4ec4f716c03e4690a799c39a87430cbb1a435d7badebf97cR433-R449 not checking whether the original format is requested and checking that value against the `allowed_formats` in the `in_array` call.

If desired, I can submit a pull request with a fix.


Discussion / hints:
Can confirm this bug can be reproduced on 11.2.4 on both the Community and the Enterprise demo.

Fix patch:
diff --git a/bundles/CoreBundle/src/DependencyInjection/Configuration.php b/bundles/CoreBundle/src/DependencyInjection/Configuration.php
index 00b96b9344b..9da6dffeba1 100644
--- a/bundles/CoreBundle/src/DependencyInjection/Configuration.php
+++ b/bundles/CoreBundle/src/DependencyInjection/Configuration.php
@@ -356,7 +356,22 @@ private function addAssetNode(ArrayNodeDefinition $rootNode): void
                     ->addDefaultsIfNotSet()
                         ->children()
                             ->arrayNode('allowed_formats')
-                                ->defaultValue(['avif', 'eps', 'gif', 'jpeg', 'jpg', 'pjpeg', 'png', 'svg', 'tiff', 'webm', 'webp'])
+                                ->defaultValue(
+                                    [
+                                        'avif',
+                                        'eps',
+                                        'gif',
+                                        'jpeg',
+                                        'jpg',
+                                        'pjpeg',
+                                        'png',
+                                        'svg',
+                                        'tiff',
+                                        'webm',
+                                        'webp',
+                                        'print'
+                                    ]
+                                )
                                 ->scalarPrototype()->end()
                             ->end()
                             ->floatNode('max_scaling_factor')
diff --git a/doc/04_Assets/03_Working_with_Thumbnails/README.md b/doc/04_Assets/03_Working_with_Thumbnails/README.md
index 58802ab5093..2d3ae6a5ea4 100644
--- a/doc/04_Assets/03_Working_with_Thumbnails/README.md
+++ b/doc/04_Assets/03_Working_with_Thumbnails/README.md
@@ -8,7 +8,7 @@ This functionality allows true single source publishing with Pimcore.
 
 ### Allowed formats
 Pimcore allows the following formats for thumbnails out of the box:
-`'avif', 'eps', 'gif', 'jpeg', 'jpg', 'pjpeg', 'png', 'svg', 'tiff', 'webm', 'webp'`.
+`'avif', 'eps', 'gif', 'jpeg', 'jpg', 'pjpeg', 'png', 'svg', 'tiff', 'webm', 'webp', 'print'`.
 
 If you want to use a different format, you can easily extend the list of supported formats.
 Keep in mind that you must copy the whole list of formats and add your desired format to it.
@@ -28,7 +28,8 @@ pimcore:
                 - 'tiff'
                 - 'webm'
                 - 'webp'
-                - 'pdf' # Add your desired format here
+                - 'pdf'
+                - 'print' # Add your desired format here
 ```
 
 ##### Thumbnails are available for following file types: 
diff --git a/models/Asset/Thumbnail/ImageThumbnailTrait.php b/models/Asset/Thumbnail/ImageThumbnailTrait.php
index ed11fa500f9..ad75bb93655 100644
--- a/models/Asset/Thumbnail/ImageThumbnailTrait.php
+++ b/models/Asset/Thumbnail/ImageThumbnailTrait.php
@@ -434,8 +434,16 @@ private function checkAllowedFormats(string $format, ?Asset $asset = null): bool
     {
         $format = strtolower($format);
         if($asset) {
+            if (
+                $format === 'original' ||
+                $format === 'source'
+            ) {
+                return true;
+            }
+
             $original = strtolower(pathinfo($asset->getRealFullPath(), PATHINFO_EXTENSION));
-            if ($format === $original || $format === 'source') {
+
+            if ($format === $original) {
                 return true;
             }
         }


Test patch: