changeset 706:90b70bb44e93

fix response of /servers/../stow
author Alain Mazy <am@orthanc.team>
date Mon, 12 May 2025 11:38:37 +0200
parents b643a16118fa
children 10c61ebe30b0 76bbaecf4c3f
files NEWS Plugin/DicomWebClient.cpp
diffstat 2 files changed, 13 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Mon May 12 10:58:00 2025 +0200
+++ b/NEWS	Mon May 12 11:38:37 2025 +0200
@@ -5,7 +5,9 @@
 * Fix calls to /studies/../series/../rendered returning a 404 if the series has
   multiple instances.
   https://discourse.orthanc-server.org/t/thumbnail-orthanc-stone-viewer-issue/5827/3
-  
+* Fix response of /servers/../stow where the study id was repeated for each instance.
+  The response also now contains the list of sent instances.
+
 
 Version 1.19 (2025-04-29)
 =========================
--- a/Plugin/DicomWebClient.cpp	Mon May 12 10:58:00 2025 +0200
+++ b/Plugin/DicomWebClient.cpp	Mon May 12 11:38:37 2025 +0200
@@ -556,26 +556,30 @@
     Json::Value tmpInstances;
     if (OrthancPlugins::RestApiGet(tmpResource, "/instances/" + resource, false))
     {
-      AddInstance(instances, tmpResource);
+      // AddInstance(instances, tmpResource);
+      instances.push_back(resource);
       AddResourceForJobContent(resourcesForJobContent, Orthanc::ResourceType_Instance, resource);
     }
     // This was not an instance, successively try with series/studies/patients
     else if ((OrthancPlugins::RestApiGet(tmpResource, "/series/" + resource, false) &&
-              OrthancPlugins::RestApiGet(tmpInstances, "/series/" + resource + "/instances", false)) ||
+              OrthancPlugins::RestApiGet(tmpInstances, "/series/" + resource + "/instances?expand=false", false)) ||
              (OrthancPlugins::RestApiGet(tmpResource, "/studies/" + resource, false) &&
-              OrthancPlugins::RestApiGet(tmpInstances, "/studies/" + resource + "/instances", false)) ||
+              OrthancPlugins::RestApiGet(tmpInstances, "/studies/" + resource + "/instances?expand=false", false)) ||
              (OrthancPlugins::RestApiGet(tmpResource, "/patients/" + resource, false) &&
-              OrthancPlugins::RestApiGet(tmpInstances, "/patients/" + resource + "/instances", false)))
+              OrthancPlugins::RestApiGet(tmpInstances, "/patients/" + resource + "/instances?expand=false", false)))
     {
       if (tmpInstances.type() != Json::arrayValue)
       {
         throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
       }
 
+      AddResourceForJobContent(resourcesForJobContent, Orthanc::StringToResourceType(tmpResource["Type"].asString().c_str()), resource);
+
       for (Json::Value::ArrayIndex j = 0; j < tmpInstances.size(); j++)
       {
-        AddInstance(instances, tmpInstances[j]);
-        AddResourceForJobContent(resourcesForJobContent, Orthanc::StringToResourceType(tmpResource["Type"].asString().c_str()), resource);
+        // AddInstance(instances, tmpInstances[j]);
+        instances.push_back(tmpInstances[j].asString());
+        AddResourceForJobContent(resourcesForJobContent, Orthanc::ResourceType_Instance, tmpInstances[j].asString());
       }
     }
     else