diff --git a/webserver/src/main/java/io/kestra/webserver/controllers/FlowController.java b/webserver/src/main/java/io/kestra/webserver/controllers/FlowController.java index 4819966924a..aaa096907f5 100644 --- a/webserver/src/main/java/io/kestra/webserver/controllers/FlowController.java +++ b/webserver/src/main/java/io/kestra/webserver/controllers/FlowController.java @@ -737,6 +737,7 @@ public HttpResponse importFlows( } } } else { + fileUpload.discard(); throw new IllegalArgumentException("Cannot import file of type " + fileName.substring(fileName.lastIndexOf('.'))); } diff --git a/webserver/src/main/java/io/kestra/webserver/controllers/TemplateController.java b/webserver/src/main/java/io/kestra/webserver/controllers/TemplateController.java index 20849f6830f..4fce83cf050 100644 --- a/webserver/src/main/java/io/kestra/webserver/controllers/TemplateController.java +++ b/webserver/src/main/java/io/kestra/webserver/controllers/TemplateController.java @@ -369,6 +369,7 @@ public HttpResponse importTemplates(@Parameter(description = "The file to } } } else { + fileUpload.discard(); throw new IllegalArgumentException("Cannot import file of type " + fileName.substring(fileName.lastIndexOf('.'))); }