Skip to content

Commit

Permalink
Lenient handling of empty Content-Disposition filename
Browse files Browse the repository at this point in the history
Closes gh-25769
  • Loading branch information
jhoeller committed Sep 14, 2020
1 parent 49d65d5 commit c2f6a98
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ public List<String> getConnection() {
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) {
if (StringUtils.hasText(filename)) {
disposition.filename(filename);
}
setContentDisposition(disposition.build());
Expand All @@ -888,7 +888,7 @@ public void setContentDisposition(ContentDisposition contentDisposition) {
*/
public ContentDisposition getContentDisposition() {
String contentDisposition = getFirst(CONTENT_DISPOSITION);
if (contentDisposition != null) {
if (StringUtils.hasText(contentDisposition)) {
return ContentDisposition.parse(contentDisposition);
}
return ContentDisposition.empty();
Expand Down

0 comments on commit c2f6a98

Please sign in to comment.