diff OrthancServer/Search/HierarchicalMatcher.cpp @ 3691:4922bdd046dd

Fix issue #140 (Modifying private tags with REST API changes VR from LO to UN) - DANGEROUS COMMIT
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 25 Feb 2020 21:44:09 +0100
parents 94f4a18a79cc
children 2a170a8f1faf
line wrap: on
line diff
--- a/OrthancServer/Search/HierarchicalMatcher.cpp	Tue Feb 25 13:57:43 2020 +0100
+++ b/OrthancServer/Search/HierarchicalMatcher.cpp	Tue Feb 25 21:44:09 2020 +0100
@@ -268,7 +268,13 @@
       if (source.findAndGetElement(tag, element).good() &&
           element != NULL)
       {
-        std::auto_ptr<DcmElement> cloned(FromDcmtkBridge::CreateElementForTag(*it));
+        if (it->IsPrivate())
+        {
+          throw OrthancException(ErrorCode_NotImplemented,
+                                 "Not applicable to private tags: " + it->Format());
+        }
+        
+        std::auto_ptr<DcmElement> cloned(FromDcmtkBridge::CreateElementForTag(*it, "" /* no private creator */));
         cloned->copyFrom(*element);
         target->insert(cloned.release());
       }