# HG changeset patch # User Sebastien Jodogne # Date 1720778127 -7200 # Node ID f375e9983943f5abf67e59a94581342a7192b022 # Parent 0f8b6214308a69fdaf3ade3be9ccf54098141725 fix diff -r 0f8b6214308a -r f375e9983943 OrthancServer/Sources/Database/FindRequest.cpp --- a/OrthancServer/Sources/Database/FindRequest.cpp Fri Jul 12 10:56:33 2024 +0200 +++ b/OrthancServer/Sources/Database/FindRequest.cpp Fri Jul 12 11:55:27 2024 +0200 @@ -34,7 +34,8 @@ { FindRequest::ParentSpecification& FindRequest::GetParentSpecification(ResourceType level) { - if (!IsResourceLevelAboveOrEqual(level, level_)) + if (!IsResourceLevelAboveOrEqual(level, level_) || + level == level_) { throw OrthancException(ErrorCode_ParameterOutOfRange); } @@ -58,7 +59,8 @@ FindRequest::ChildrenSpecification& FindRequest::GetChildrenSpecification(ResourceType level) { - if (!IsResourceLevelAboveOrEqual(level_, level)) + if (!IsResourceLevelAboveOrEqual(level_, level) || + level == level_) { throw OrthancException(ErrorCode_ParameterOutOfRange); } diff -r 0f8b6214308a -r f375e9983943 OrthancServer/Sources/Database/FindRequest.h --- a/OrthancServer/Sources/Database/FindRequest.h Fri Jul 12 10:56:33 2024 +0200 +++ b/OrthancServer/Sources/Database/FindRequest.h Fri Jul 12 11:55:27 2024 +0200 @@ -431,7 +431,8 @@ bool IsRetrieveOneInstanceIdentifier() const { return (retrieveOneInstanceIdentifier_ || - GetChildrenSpecification(ResourceType_Instance).IsRetrieveIdentifiers()); + (level_ != ResourceType_Instance && + GetChildrenSpecification(ResourceType_Instance).IsRetrieveIdentifiers())); } }; } diff -r 0f8b6214308a -r f375e9983943 OrthancServer/Sources/ResourceFinder.cpp --- a/OrthancServer/Sources/ResourceFinder.cpp Fri Jul 12 10:56:33 2024 +0200 +++ b/OrthancServer/Sources/ResourceFinder.cpp Fri Jul 12 11:55:27 2024 +0200 @@ -624,8 +624,8 @@ { if (request_.GetLevel() == ResourceType_Patient) { - request_.GetParentSpecification(ResourceType_Patient).SetRetrieveMainDicomTags(true); - request_.GetParentSpecification(ResourceType_Patient).SetRetrieveMetadata(true); + request_.SetRetrieveMainDicomTags(true); + request_.SetRetrieveMetadata(true); requestedPatientTags_.insert(tag); } else @@ -634,8 +634,19 @@ * This comes from the fact that patient-level tags are copied * at the study level, as implemented by "ResourcesContent::AddResource()". **/ - request_.GetParentSpecification(ResourceType_Study).SetRetrieveMainDicomTags(true); - request_.GetParentSpecification(ResourceType_Study).SetRetrieveMetadata(true); + requestedStudyTags_.insert(tag); + + if (request_.GetLevel() == ResourceType_Study) + { + request_.SetRetrieveMainDicomTags(true); + request_.SetRetrieveMetadata(true); + } + else + { + request_.GetParentSpecification(ResourceType_Study).SetRetrieveMainDicomTags(true); + request_.GetParentSpecification(ResourceType_Study).SetRetrieveMetadata(true); + } + requestedStudyTags_.insert(tag); } @@ -652,8 +663,17 @@ } else { - request_.GetParentSpecification(ResourceType_Study).SetRetrieveMainDicomTags(true); - request_.GetParentSpecification(ResourceType_Study).SetRetrieveMetadata(true); + if (request_.GetLevel() == ResourceType_Study) + { + request_.SetRetrieveMainDicomTags(true); + request_.SetRetrieveMetadata(true); + } + else + { + request_.GetParentSpecification(ResourceType_Study).SetRetrieveMainDicomTags(true); + request_.GetParentSpecification(ResourceType_Study).SetRetrieveMetadata(true); + } + requestedStudyTags_.insert(tag); } @@ -671,8 +691,17 @@ } else { - request_.GetParentSpecification(ResourceType_Series).SetRetrieveMainDicomTags(true); - request_.GetParentSpecification(ResourceType_Series).SetRetrieveMetadata(true); + if (request_.GetLevel() == ResourceType_Series) + { + request_.SetRetrieveMainDicomTags(true); + request_.SetRetrieveMetadata(true); + } + else + { + request_.GetParentSpecification(ResourceType_Series).SetRetrieveMainDicomTags(true); + request_.GetParentSpecification(ResourceType_Series).SetRetrieveMetadata(true); + } + requestedSeriesTags_.insert(tag); }