diff --git a/node/build.gradle b/node/build.gradle index f9005d9349..9716079360 100644 --- a/node/build.gradle +++ b/node/build.gradle @@ -90,6 +90,8 @@ dependencies { // TypeSafe Config: for simple and human friendly config files. compile "com.typesafe:config:1.3.0" + compile "org.apache.httpcomponents:httpclient:4.5.2" + // Unit testing helpers. testCompile 'junit:junit:4.12' testCompile 'org.assertj:assertj-core:3.4.1' diff --git a/node/src/main/kotlin/com/r3corda/node/servlets/DataUploadServlet.kt b/node/src/main/kotlin/com/r3corda/node/servlets/DataUploadServlet.kt index e8551d2b98..6a0944dd16 100644 --- a/node/src/main/kotlin/com/r3corda/node/servlets/DataUploadServlet.kt +++ b/node/src/main/kotlin/com/r3corda/node/servlets/DataUploadServlet.kt @@ -35,6 +35,13 @@ class DataUploadServlet : HttpServlet() { val upload = ServletFileUpload() val iterator = upload.getItemIterator(req) val messages = ArrayList() + + if(!iterator.hasNext()) + { + resp.sendError(HttpServletResponse.SC_BAD_REQUEST, "Got an upload request with no files") + return + } + while (iterator.hasNext()) { val item = iterator.next() if (item.name != null && !acceptor.acceptableFileExtensions.any { item.name.endsWith(it) }) {