Mercurial > hg > orthanc
diff OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp @ 5244:72dfa0ac84eb db-protobuf
lookup for labels in orthanc explorer
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 06 Apr 2023 16:55:55 +0200 |
parents | 367e8af46cfd |
children | a7d95f951f8a |
line wrap: on
line diff
--- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp Thu Apr 06 16:04:23 2023 +0200 +++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp Thu Apr 06 16:55:55 2023 +0200 @@ -1918,6 +1918,15 @@ } + static void CheckValidLabels(const std::set<std::string>& labels) + { + for (std::set<std::string>::const_iterator it = labels.begin(); it != labels.end(); ++it) + { + ServerToolbox::CheckValidLabel(*it); + } + } + + void StatelessDatabaseOperations::ApplyLookupResources(std::vector<std::string>& resourcesId, std::vector<std::string>* instancesId, const DatabaseLookup& lookup, @@ -1967,6 +1976,9 @@ throw OrthancException(ErrorCode_NotImplemented, "The database backend doesn't support labels"); } + CheckValidLabels(withLabels); + CheckValidLabels(withoutLabels); + std::vector<DatabaseConstraint> normalized; NormalizeLookup(normalized, lookup, queryLevel); @@ -3627,10 +3639,7 @@ } }; - if (!Toolbox::IsAsciiString(label)) - { - throw OrthancException(ErrorCode_ParameterOutOfRange, "A label must only contain ASCII characters"); - } + ServerToolbox::CheckValidLabel(label); Operations operations(publicId, level, label, operation); Apply(operations);