# HG changeset patch # User Sebastien Jodogne # Date 1598533193 -7200 # Node ID 8517c47eedd2e8b1e7f61401efc60702c6db3741 # Parent ad64038bcbc530b42880836a5df85f9e86f5bc1e# Parent e34c89e89aacc974e25955da259e10ec1f994fae merge diff -r ad64038bcbc5 -r 8517c47eedd2 NEWS --- a/NEWS Thu Aug 27 14:59:15 2020 +0200 +++ b/NEWS Thu Aug 27 14:59:53 2020 +0200 @@ -1,6 +1,12 @@ Pending changes in the mainline =============================== +Maintenance +----------- + +* Underscores are now allowed in peers/modalities symbolic names +* Fix compatibility with C-MOVE SCU requests issued by Ambra + Version 1.7.3 (2020-08-24) ========================== diff -r ad64038bcbc5 -r 8517c47eedd2 OrthancServer/Sources/OrthancConfiguration.cpp --- a/OrthancServer/Sources/OrthancConfiguration.cpp Thu Aug 27 14:59:15 2020 +0200 +++ b/OrthancServer/Sources/OrthancConfiguration.cpp Thu Aug 27 14:59:53 2020 +0200 @@ -181,10 +181,10 @@ for (size_t j = 0; j < s.size(); j++) { if (!isalnum(s[j]) && - s[j] != '-') + s[j] != '-' && s[j] != '_') { throw OrthancException(ErrorCode_BadFileFormat, - "Only alphanumeric and dash characters are allowed " + "Only alphanumeric, dash characters and underscores are allowed " "in the names of modalities/peers, but found: " + s); } } diff -r ad64038bcbc5 -r 8517c47eedd2 OrthancServer/Sources/OrthancMoveRequestHandler.cpp --- a/OrthancServer/Sources/OrthancMoveRequestHandler.cpp Thu Aug 27 14:59:15 2020 +0200 +++ b/OrthancServer/Sources/OrthancMoveRequestHandler.cpp Thu Aug 27 14:59:53 2020 +0200 @@ -205,6 +205,23 @@ } + static bool IsNonEmptyTag(const DicomMap& dicom, + const DicomTag& tag) + { + const DicomValue* value = dicom.TestAndGetValue(tag); + if (value == NULL || + value->IsNull() || + value->IsBinary()) + { + return false; + } + else + { + return !value->GetContent().empty(); + } + } + + bool OrthancMoveRequestHandler::LookupIdentifiers(std::vector& publicIds, ResourceType level, const DicomMap& input) @@ -218,8 +235,17 @@ break; case ResourceType_Study: - tag = (input.HasTag(DICOM_TAG_ACCESSION_NUMBER) ? - DICOM_TAG_ACCESSION_NUMBER : DICOM_TAG_STUDY_INSTANCE_UID); + // The test below using "IsNonEmptyTag()" fixes compatibility + // with Ambra C-FIND SCU: + // https://groups.google.com/g/orthanc-users/c/yIUnZ9v9-Zs/m/GQPXiAOiCQAJ + if (IsNonEmptyTag(input, DICOM_TAG_ACCESSION_NUMBER)) + { + tag = DICOM_TAG_ACCESSION_NUMBER; + } + else + { + tag = DICOM_TAG_STUDY_INSTANCE_UID; + } break; case ResourceType_Series: @@ -373,7 +399,7 @@ } else { - throw OrthancException(ErrorCode_BadRequest, "Invalid fields in a C-MOVE request"); + throw OrthancException(ErrorCode_BadRequest, "No DICOM identifier provided in the C-MOVE request for this query retrieve level"); } } }