changeset 5996:6ee625ebd09c

Fixed interpretation of returnUnsupportedImage in /preview route
author Alain Mazy <am@orthanc.team>
date Wed, 05 Feb 2025 16:09:39 +0100 (3 months ago)
parents 9c20ede25ef8
children 3d8d227dd96f
files NEWS OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp
diffstat 2 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Thu Jan 30 09:02:01 2025 +0100
+++ b/NEWS	Wed Feb 05 16:09:39 2025 +0100
@@ -6,6 +6,7 @@
 
 * In the "ExtendedFind" mode, optimized "tools/find" when "StorageAccessMode" is 
   set to "Never".
+* Fixed interpretation of returnUnsupportedImage in /preview route. 
 
 
 Version 1.12.6 (2025-01-22)
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp	Thu Jan 30 09:02:01 2025 +0100
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp	Wed Feb 05 16:09:39 2025 +0100
@@ -850,7 +850,7 @@
             .SetTag("Instances")
             .SetUriArgument("id", "Orthanc identifier of the DICOM instance of interest")
             .SetHttpGetArgument("quality", RestApiCallDocumentation::Type_Number, "Quality for JPEG images (between 1 and 100, defaults to 90)", false)
-            .SetHttpGetArgument("returnUnsupportedImage", RestApiCallDocumentation::Type_Boolean, "Returns an unsupported.png placeholder image if unable to provide the image instead of returning a 415 HTTP error (defaults to false)", false)
+            .SetHttpGetArgument("returnUnsupportedImage", RestApiCallDocumentation::Type_Boolean, "Returns an unsupported.png placeholder image if unable to provide the image instead of returning a 415 HTTP error (value is true if option is present)", false)
             .SetHttpHeader("Accept", "Format of the resulting image. Can be `image/png` (default), `image/jpeg` or `image/x-portable-arbitrarymap`")
             .AddAnswerType(MimeType_Png, "PNG image")
             .AddAnswerType(MimeType_Jpeg, "JPEG image")
@@ -913,7 +913,8 @@
           }
           else
           {
-            if (call.HasArgument("returnUnsupportedImage"))
+            // if present and not explicitely set to false
+            if (call.HasArgument("returnUnsupportedImage") && call.GetBooleanArgument("returnUnsupportedImage", true))
             {
               std::string root = "";
               for (size_t i = 1; i < call.GetFullUri().size(); i++)