# HG changeset patch # User Benjamin Golinvaux # Date 1566202684 -7200 # Node ID c465c6ee2bfb987a3235c0f56d9f50b6c5d0bc94 # Parent cfaa9eded17e9ddef5ef19288e409e40197d5bcc# Parent 22bdb9c91ebfa96bdc07675c18c3f18c0b5759dd merge diff -r cfaa9eded17e -r c465c6ee2bfb NEWS --- a/NEWS Mon Aug 19 10:17:01 2019 +0200 +++ b/NEWS Mon Aug 19 10:18:04 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 cfaa9eded17e -r c465c6ee2bfb OrthancServer/OrthancRestApi/OrthancRestApi.cpp --- a/OrthancServer/OrthancRestApi/OrthancRestApi.cpp Mon Aug 19 10:17:01 2019 +0200 +++ b/OrthancServer/OrthancRestApi/OrthancRestApi.cpp Mon Aug 19 10:18:04 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);