changeset 3493:c465c6ee2bfb

merge
author Benjamin Golinvaux <bgo@osimis.io>
date Mon, 19 Aug 2019 10:18:04 +0200
parents cfaa9eded17e (current diff) 22bdb9c91ebf (diff)
children e0e9df6e5c92
files
diffstat 2 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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
 
 
--- 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);