diff OrthancServer/OrthancRestApi/OrthancRestResources.cpp @ 3163:cf91b6f22278

Fix issue #90 (C-Find shall match missing tags to null/empty string)
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 24 Jan 2019 18:04:55 +0100
parents 61da3c9b4121
children 8ea7c4546c3a
line wrap: on
line diff
--- a/OrthancServer/OrthancRestApi/OrthancRestResources.cpp	Thu Jan 24 16:47:05 2019 +0100
+++ b/OrthancServer/OrthancRestApi/OrthancRestResources.cpp	Thu Jan 24 18:04:55 2019 +0100
@@ -1415,9 +1415,16 @@
                                  "Tag \"" + members[i] + "\" should be associated with a string");
         }
 
-        query.AddRestConstraint(FromDcmtkBridge::ParseTag(members[i]), 
-                                request[KEY_QUERY][members[i]].asString(),
-                                caseSensitive, true);
+        const std::string value = request[KEY_QUERY][members[i]].asString();
+
+        if (!value.empty())
+        {
+          // An empty string corresponds to an universal constraint,
+          // so we ignore it. This mimics the behavior of class
+          // "OrthancFindRequestHandler"
+          query.AddRestConstraint(FromDcmtkBridge::ParseTag(members[i]), 
+                                  value, caseSensitive, true);
+        }
       }
 
       FindVisitor visitor;