# HG changeset patch # User Sebastien Jodogne # Date 1565959095 -7200 # Node ID 22bdb9c91ebfa96bdc07675c18c3f18c0b5759dd # Parent 786fce009be8fc08bc6222a7a17c96d7f438b1e6 Log an explicit error if uploading an empty DICOM file using REST API diff -r 786fce009be8 -r 22bdb9c91ebf NEWS --- a/NEWS Sat Aug 10 13:42:38 2019 +0200 +++ b/NEWS Fri Aug 16 14:38:15 2019 +0200 @@ -4,6 +4,7 @@ Maintenance ----------- +* Log an explicit error if uploading an empty DICOM file using REST API * Fix compatibility of LSB binaries with Ubuntu >= 18.04 diff -r 786fce009be8 -r 22bdb9c91ebf OrthancServer/OrthancRestApi/OrthancRestApi.cpp --- a/OrthancServer/OrthancRestApi/OrthancRestApi.cpp Sat Aug 10 13:42:38 2019 +0200 +++ b/OrthancServer/OrthancRestApi/OrthancRestApi.cpp Fri Aug 16 14:38:15 2019 +0200 @@ -110,13 +110,14 @@ { ServerContext& context = OrthancRestApi::GetContext(call); + LOG(INFO) << "Receiving a DICOM file of " << call.GetBodySize() << " bytes through HTTP"; + if (call.GetBodySize() == 0) { - return; + throw OrthancException(ErrorCode_BadFileFormat, + "Received an empty DICOM file"); } - LOG(INFO) << "Receiving a DICOM file of " << call.GetBodySize() << " bytes through HTTP"; - // TODO Remove unneccessary memcpy std::string postData; call.BodyToString(postData);