Mercurial > hg > orthanc
diff OrthancServer/Sources/OrthancRestApi/OrthancRestApi.cpp @ 5611:1a995c6f9dae
deprecating the "requestedTags" GET argument in favor of "requested-tags"
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 09 May 2024 10:43:10 +0200 |
parents | fa000bd60bbe |
children | f7adfb22e20e |
line wrap: on
line diff
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestApi.cpp Wed May 08 10:30:34 2024 +0200 +++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestApi.cpp Thu May 09 10:43:10 2024 +0200 @@ -489,7 +489,8 @@ static const std::string GET_SIMPLIFY = "simplify"; static const std::string GET_FULL = "full"; static const std::string GET_SHORT = "short"; - static const std::string GET_REQUESTED_TAGS = "requestedTags"; + static const std::string GET_REQUESTED_TAGS_OLD = "requestedTags"; // This was the only option in Orthanc <= 1.12.3 + static const std::string GET_REQUESTED_TAGS = "requested-tags"; static const std::string POST_SIMPLIFY = "Simplify"; static const std::string POST_FULL = "Full"; @@ -603,18 +604,29 @@ { requestedTags.clear(); + std::string s; + if (call.HasArgument(GET_REQUESTED_TAGS)) { + s = call.GetArgument(GET_REQUESTED_TAGS, ""); + } + else if (call.HasArgument(GET_REQUESTED_TAGS_OLD)) + { + // This is for backward compatibility with Orthanc <= 1.12.3 + s = call.GetArgument(GET_REQUESTED_TAGS_OLD, ""); + } + + if (!s.empty()) + { try { - FromDcmtkBridge::ParseListOfTags(requestedTags, call.GetArgument("requestedTags", "")); + FromDcmtkBridge::ParseListOfTags(requestedTags, s); } catch (OrthancException& ex) { throw OrthancException(ErrorCode_BadRequest, std::string("Invalid requestedTags argument: ") + ex.What() + " " + ex.GetDetails()); } } - } void OrthancRestApi::DocumentRequestedTags(RestApiGetCall& call)