When a Multipart Form request is used with an empty string as Filename, a "No Filename" exception is thrown. Can an empty String check be added to prevent the code from failing in empty string scenarios?
https://github.com/spring-projects/spring-framework/blob/3b0f14fd2e1964dfd9a23cbb19d6eb240e7e511e/spring-web/src/main/java/org/springframework/http/HttpHeaders.java#L864
public void setContentDispositionFormData(String name, @Nullable String filename) {
Assert.notNull(name, "Name must not be null");
ContentDisposition.Builder disposition = ContentDisposition.builder("form-data").name(name);
if (filename != null) { // Add Empty String check here, don't let through if empty String
disposition.filename(filename); // calls method below
}
setContentDisposition(disposition.build());
}
https://github.com/spring-projects/spring-framework/blob/29885e2b9f18646fd8b0971daa51ff7ce2401935/spring-web/src/main/java/org/springframework/http/ContentDisposition.java#L601
@Override
public Builder filename(String filename) {
Assert.hasText(filename, "No filename"); // Assertion Fails since the the filename does not have text
this.filename = filename;
return this;
}