Mercurial > hg > orthanc
diff OrthancServer/OrthancRestApi/OrthancRestApi.cpp @ 3491:22bdb9c91ebf
Log an explicit error if uploading an empty DICOM file using REST API
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 16 Aug 2019 14:38:15 +0200 |
parents | 962e5f00744b |
children | 94f4a18a79cc |
line wrap: on
line diff
--- 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);