changeset 62:222f0652025f

fix get argument values that were transformed to lowercase
author Alain Mazy <am@osimis.io>
date Wed, 16 Nov 2022 14:42:48 +0100
parents a2ed57d8a2f0
children 729f02c2eed7
files NEWS Plugin/AssociativeArray.cpp Plugin/AssociativeArray.h Plugin/Plugin.cpp
diffstat 4 files changed, 17 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Thu Nov 10 10:25:27 2022 +0100
+++ b/NEWS	Wed Nov 16 14:42:48 2022 +0100
@@ -1,3 +1,10 @@
+Pending changes
+====================
+
+* fix: get argument values were transformed to lower case
+* the "osimis-web-viewer" StandardConfigurations now take into account
+  the token get argument used when downloading a study from the UI
+
 2022-11-10 - v 0.4.0
 ====================
 
--- a/Plugin/AssociativeArray.cpp	Thu Nov 10 10:25:27 2022 +0100
+++ b/Plugin/AssociativeArray.cpp	Wed Nov 16 14:42:48 2022 +0100
@@ -25,23 +25,19 @@
   AssociativeArray::AssociativeArray(uint32_t headersCount,
                                      const char *const *headersKeys,
                                      const char *const *headersValues,
-                                     bool caseSensitive) :
-    caseSensitive_(caseSensitive)
+                                     bool caseSensitiveKeys) :
+    caseSensitiveKeys_(caseSensitiveKeys)
   {
     for (uint32_t i = 0; i < headersCount; i++)
     {
-      std::string value;
+      std::string key = headersKeys[i];
 
-      if (caseSensitive)
+      if (!caseSensitiveKeys)
       {
-        Orthanc::Toolbox::ToLowerCase(value, headersValues[i]);
-      }
-      else
-      {
-        value = headersValues[i];
+        Orthanc::Toolbox::ToLowerCase(key, headersKeys[i]);
       }
         
-      map_[headersKeys[i]] = value;
+      map_[headersKeys[i]] = headersValues[i];
     }
   }
 
@@ -56,7 +52,7 @@
 
     Map::const_iterator found;
 
-    if (caseSensitive_)
+    if (caseSensitiveKeys_)
     {
       found = map_.find(key);
     }
--- a/Plugin/AssociativeArray.h	Thu Nov 10 10:25:27 2022 +0100
+++ b/Plugin/AssociativeArray.h	Wed Nov 16 14:42:48 2022 +0100
@@ -31,13 +31,13 @@
     typedef std::map<std::string, std::string>  Map;
 
     Map  map_;
-    bool caseSensitive_;
+    bool caseSensitiveKeys_;
 
   public:
     AssociativeArray(uint32_t headersCount,
                      const char *const *headersKeys,
                      const char *const *headersValues,
-                     bool caseSensitive);
+                     bool caseSensitiveKeys);
     
     bool GetValue(std::string& value,
                   const std::string& key) const;
--- a/Plugin/Plugin.cpp	Thu Nov 10 10:25:27 2022 +0100
+++ b/Plugin/Plugin.cpp	Wed Nov 16 14:42:48 2022 +0100
@@ -348,6 +348,7 @@
             uncheckedResources_.insert("/osimis-viewer/config.js");
 
             tokens_.insert(OrthancPlugins::Token(OrthancPlugins::TokenType_HttpHeader, "token"));
+            tokens_.insert(OrthancPlugins::Token(OrthancPlugins::TokenType_GetArgument, "token"));  // for download links
           }
 
           if (standardConfigurations.find("stone-webviewer") != standardConfigurations.end())