diff OrthancServer/DicomProtocol/DicomUserConnection.cpp @ 1707:9a04ad916831

more tolerant c-find scp
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 13 Oct 2015 16:54:21 +0200
parents 7dae55228b16
children ec66a16aa398
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();