diff OrthancServer/Sources/ServerToolbox.cpp @ 5224:feba2b0e91bc

Fix a crash in /tools/reconstruct triggered by the Housekeeper plugin when only changing the StorageCompression.
author Alain Mazy <am@osimis.io>
date Mon, 03 Apr 2023 22:19:42 +0200
parents 0ea402b4d901
children 72dfa0ac84eb
line wrap: on
line diff
--- a/OrthancServer/Sources/ServerToolbox.cpp	Mon Apr 03 15:13:58 2023 +0200
+++ b/OrthancServer/Sources/ServerToolbox.cpp	Mon Apr 03 22:19:42 2023 +0200
@@ -281,14 +281,8 @@
           std::string resultPublicId;  // ignored
           std::unique_ptr<DicomInstanceToStore> dicomInstancetoStore(DicomInstanceToStore::CreateFromParsedDicomFile(locker.GetDicom()));
 
-          context.GetIndex().GetAllMetadata(instanceMetadata, *it, ResourceType_Instance);
-          
-          for (InstanceMetadata::const_iterator itm = instanceMetadata.begin();
-              itm != instanceMetadata.end(); ++itm)
-          {
-            dicomInstancetoStore->AddMetadata(ResourceType_Instance, itm->first, itm->second);
-          }
-
+          // TODO: TranscodeAndStore and specifically ServerIndex::Store have been "poluted" by the isReconstruct parameter
+          // we should very likely refactor it
           context.TranscodeAndStore(resultPublicId, dicomInstancetoStore.get(), StoreInstanceMode_OverwriteDuplicate, true);
         }
       }