mirror of
https://github.com/corda/corda.git
synced 2024-12-24 07:06:44 +00:00
Error now occurs on upload if no files are sent. Added apache httpcomponents as a dependency.
This commit is contained in:
parent
b050411810
commit
f6069e1e15
@ -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'
|
||||
|
@ -35,6 +35,13 @@ class DataUploadServlet : HttpServlet() {
|
||||
val upload = ServletFileUpload()
|
||||
val iterator = upload.getItemIterator(req)
|
||||
val messages = ArrayList<String>()
|
||||
|
||||
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) }) {
|
||||
|
Loading…
Reference in New Issue
Block a user