changeset 1707:9a04ad916831

more tolerant c-find scp
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 13 Oct 2015 16:54:21 +0200
parents e8a7512a1e40
children 275780da54ae d72cf0c11f42
files OrthancServer/DicomProtocol/DicomUserConnection.cpp
diffstat 1 files changed, 11 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/DicomProtocol/DicomUserConnection.cpp	Tue Oct 13 16:48:02 2015 +0200
+++ b/OrthancServer/DicomProtocol/DicomUserConnection.cpp	Tue Oct 13 16:54:21 2015 +0200
@@ -384,8 +384,9 @@
   }
 
 
-  static void CheckFindQuery(ResourceType level,
-                             const DicomMap& fields)
+  static void FixFindQuery(DicomMap& fixedQuery,
+                           ResourceType level,
+                           const DicomMap& fields)
   {
     std::set<DicomTag> allowedTags;
 
@@ -422,8 +423,11 @@
       const DicomTag& tag = query.GetElement(i).GetTag();
       if (allowedTags.find(tag) == allowedTags.end())
       {
-        LOG(ERROR) << "Tag not allowed for this C-Find level: " << tag;
-        throw OrthancException(ErrorCode_BadRequest);
+        LOG(WARNING) << "Tag not allowed for this C-Find level, will be ignored: " << tag;
+      }
+      else
+      {
+        fixedQuery.SetValue(tag, query.GetElement(i).GetValue());
       }
     }
   }
@@ -471,9 +475,10 @@
 
   void DicomUserConnection::Find(DicomFindAnswers& result,
                                  ResourceType level,
-                                 const DicomMap& fields)
+                                 const DicomMap& originalFields)
   {
-    CheckFindQuery(level, fields);
+    DicomMap fields;
+    FixFindQuery(fields, level, originalFields);
 
     CheckIsOpen();