# HG changeset patch # User Sebastien Jodogne # Date 1602319125 -7200 # Node ID 416c35da7d25e88a19712ab463e39e3b392cba1e # Parent 64f57c9d5f7939f0f294e141417eef54b87b7931 robustness against non-dicom files diff -r 64f57c9d5f79 -r 416c35da7d25 OrthancServer/Sources/OrthancWebDav.cpp --- a/OrthancServer/Sources/OrthancWebDav.cpp Fri Oct 09 18:10:24 2020 +0200 +++ b/OrthancServer/Sources/OrthancWebDav.cpp Sat Oct 10 10:38:45 2020 +0200 @@ -1226,17 +1226,28 @@ // instance.SetOrigin(DicomInstanceOrigin_WebDav); // TODO instance.SetBuffer(content.c_str(), content.size()); - std::string publicId; - StoreStatus status = context_.Store(publicId, instance, StoreInstanceMode_Default); - if (status == StoreStatus_Success || - status == StoreStatus_AlreadyStored) + bool success = false; + + try { - LOG(INFO) << "Successfully imported DICOM instance from WebDAV: " << path << " (Orthanc ID: " << publicId << ")"; - uploads_.DeleteItem(uri); + std::string publicId; + StoreStatus status = context_.Store(publicId, instance, StoreInstanceMode_Default); + if (status == StoreStatus_Success || + status == StoreStatus_AlreadyStored) + { + LOG(INFO) << "Successfully imported DICOM instance from WebDAV: " << path << " (Orthanc ID: " << publicId << ")"; + success = true; + } } - else + catch (OrthancException& e) { - LOG(WARNING) << "Cannot import DICOM instance from WebWAV: " << path; + } + + uploads_.DeleteItem(uri); + + if (!success) + { + LOG(WARNING) << "Cannot import DICOM instance from WebWAV (maybe not a DICOM file): " << path; } } }