Mercurial > hg > orthanc
diff OrthancServer/Sources/ServerContext.cpp @ 5058:d4e5ca0c9307
Fix the "Never" option of the "StorageAccessOnFind" that was sill accessing files (bug introduced in 1.11.0)
author | Alain Mazy <am@osimis.io> |
---|---|
date | Wed, 03 Aug 2022 10:49:50 +0200 |
parents | 22966345eaba |
children | e69a3ff39bc5 |
line wrap: on
line diff
--- a/OrthancServer/Sources/ServerContext.cpp Tue Aug 02 11:38:31 2022 +0200 +++ b/OrthancServer/Sources/ServerContext.cpp Wed Aug 03 10:49:50 2022 +0200 @@ -1442,15 +1442,14 @@ // Optimization in Orthanc 1.5.1 - Don't read the full JSON from // the disk if only "main DICOM tags" are to be returned - std::unique_ptr<Json::Value> dicomAsJson; + boost::shared_ptr<Json::Value> dicomAsJson; bool hasOnlyMainDicomTags; DicomMap dicom; DicomMap allMainDicomTagsFromDB; - if (findStorageAccessMode_ == FindStorageAccessMode_DatabaseOnly || - findStorageAccessMode_ == FindStorageAccessMode_DiskOnAnswer || - fastLookup->HasOnlyMainDicomTags()) + if (!IsStorageAccessAllowedForAnswers(findStorageAccessMode_) + || fastLookup->HasOnlyMainDicomTags()) { // Case (1): The main DICOM tags, as stored in the database, // are sufficient to look for match @@ -1538,8 +1537,7 @@ } else { - if ((findStorageAccessMode_ == FindStorageAccessMode_DiskOnLookupAndAnswer || - findStorageAccessMode_ == FindStorageAccessMode_DiskOnAnswer) && + if (IsStorageAccessAllowedForAnswers(findStorageAccessMode_) && dicomAsJson.get() == NULL && isDicomAsJsonNeeded) { @@ -2336,13 +2334,14 @@ const std::string& publicId, ResourceType level, DicomToJsonFormat format, - const std::set<DicomTag>& requestedTags) + const std::set<DicomTag>& requestedTags, + bool allowStorageAccess) { std::string unusedInstanceId; Json::Value* unusedDicomAsJson = NULL; DicomMap unusedMainDicomTags; - return ExpandResource(target, publicId, unusedMainDicomTags, unusedInstanceId, unusedDicomAsJson, level, format, requestedTags); + return ExpandResource(target, publicId, unusedMainDicomTags, unusedInstanceId, unusedDicomAsJson, level, format, requestedTags, allowStorageAccess); } bool ServerContext::ExpandResource(Json::Value& target, @@ -2352,11 +2351,12 @@ const Json::Value* dicomAsJson, // optional: the dicom-as-json for the resource (if already available) ResourceType level, DicomToJsonFormat format, - const std::set<DicomTag>& requestedTags) + const std::set<DicomTag>& requestedTags, + bool allowStorageAccess) { ExpandedResource resource; - if (ExpandResource(resource, publicId, mainDicomTags, instanceId, dicomAsJson, level, requestedTags, ExpandResourceDbFlags_Default)) + if (ExpandResource(resource, publicId, mainDicomTags, instanceId, dicomAsJson, level, requestedTags, ExpandResourceDbFlags_Default, allowStorageAccess)) { SerializeExpandedResource(target, resource, format, requestedTags); return true; @@ -2372,7 +2372,8 @@ const Json::Value* dicomAsJson, // optional: the dicom-as-json for the resource (if already available) ResourceType level, const std::set<DicomTag>& requestedTags, - ExpandResourceDbFlags expandFlags) + ExpandResourceDbFlags expandFlags, + bool allowStorageAccess) { // first try to get the tags from what is already available @@ -2420,7 +2421,8 @@ } // possibly merge missing requested tags from dicom-as-json - if (!resource.missingRequestedTags_.empty() && !DicomMap::HasOnlyComputedTags(resource.missingRequestedTags_)) + if (allowStorageAccess + && !resource.missingRequestedTags_.empty() && !DicomMap::HasOnlyComputedTags(resource.missingRequestedTags_)) { OrthancConfiguration::ReaderLock lock; if (lock.GetConfiguration().IsWarningEnabled(Warnings_001_TagsBeingReadFromStorage))