diff Framework/Loaders/SeriesThumbnailsLoader.cpp @ 1254:7a0460c5e98e broker

don't follow redirections if contacting the Orthanc REST API
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 08 Jan 2020 14:01:36 +0100
parents c471a0aa137b
children 0ca50d275b9a
line wrap: on
line diff
--- a/Framework/Loaders/SeriesThumbnailsLoader.cpp	Wed Jan 08 10:35:39 2020 +0100
+++ b/Framework/Loaders/SeriesThumbnailsLoader.cpp	Wed Jan 08 14:01:36 2020 +0100
@@ -47,7 +47,7 @@
     }
     else
     {
-      return SeriesThumbnailType_Unknown;
+      return SeriesThumbnailType_Unsupported;
     }
   }
 
@@ -185,7 +185,7 @@
       }
       else
       {
-        SeriesThumbnailType type = SeriesThumbnailType_Unknown;
+        SeriesThumbnailType type = SeriesThumbnailType_Unsupported;
 
         std::string sopClassUid;
         if (value.size() > 0 &&
@@ -429,7 +429,19 @@
   {
     const OracleCommandBase& command = dynamic_cast<const OracleCommandBase&>(message.GetOrigin());
     assert(command.HasPayload());
-    dynamic_cast<Handler&>(command.GetPayload()).HandleError();
+
+    if (command.GetType() == IOracleCommand::Type_GetOrthancImage)
+    {
+      // This is presumably a HTTP status 301 (Moved permanently)
+      // because of an unsupported DICOM file in "/preview"
+      const ThumbnailInformation& info = dynamic_cast<const ThumbnailInformation&>(command.GetPayload());
+      AcquireThumbnail(info.GetDicomSource(), info.GetStudyInstanceUid(),
+                       info.GetSeriesInstanceUid(), new Thumbnail(SeriesThumbnailType_Unsupported));
+    }
+    else
+    {
+      dynamic_cast<Handler&>(command.GetPayload()).HandleError();
+    }
   }
 
 
@@ -490,7 +502,7 @@
 
     if (found == thumbnails_.end())
     {
-      return SeriesThumbnailType_Unknown;
+      return SeriesThumbnailType_NotLoaded;
     }
     else
     {