# HG changeset patch # User Alain Mazy # Date 1729775323 -7200 # Node ID 57ab63fe91083019fbce606f1e5ee50e0e281347 # Parent b24b61331566c835c7411e3e71875488299af965 tools/find: Limit and Since are now forbidden when filtering on DICOM tags that are not stored in DB diff -r b24b61331566 -r 57ab63fe9108 NEWS --- a/NEWS Mon Oct 21 18:24:09 2024 +0200 +++ b/NEWS Thu Oct 24 15:08:43 2024 +0200 @@ -43,6 +43,8 @@ resource (e.g: Metadata, Children, ...) * With DB backend with "HasExtendedFind" support, a new /tools/count-resources API route is similar to tools/find but only returns the number of resources matching the criteria. +* With DB backend with "HasExtendedFind" support, usage of 'Limit' and 'Since in /tools/find + is not allowed if your query includes filtering on DICOM tags that are not stored in DB. Maintenance diff -r b24b61331566 -r 57ab63fe9108 OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp --- a/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp Mon Oct 21 18:24:09 2024 +0200 +++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp Thu Oct 24 15:08:43 2024 +0200 @@ -3465,6 +3465,8 @@ ResourceFinder finder(level, responseContent); + DatabaseLookup dicomTagLookup; + { // common query code bool caseSensitive = false; if (request.isMember(KEY_CASE_SENSITIVE)) @@ -3473,7 +3475,6 @@ } { // DICOM Tag query - DatabaseLookup dicomTagLookup; Json::Value::Members members = request[KEY_QUERY].getMemberNames(); for (size_t i = 0; i < members.size(); i++) @@ -3601,6 +3602,13 @@ finder.SetDatabaseLimits(context.GetDatabaseLimits(level)); + if ((request.isMember(KEY_LIMIT) || request.isMember(KEY_SINCE)) && + !dicomTagLookup.HasOnlyMainDicomTags()) + { + throw OrthancException(ErrorCode_BadRequest, + "Unable to use " + std::string(KEY_LIMIT) + " or " + std::string(KEY_SINCE) + " in tools/find when querying tags that are not stored as MainDicomTags in the Database"); + } + if (request.isMember(KEY_LIMIT)) { int64_t tmp = request[KEY_LIMIT].asInt64();