提交 c2f6a98c 编写于 作者: J Juergen Hoeller

Lenient handling of empty Content-Disposition filename

Closes gh-25769
上级 49d65d5c
......@@ -861,7 +861,7 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
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());
......@@ -888,7 +888,7 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
*/
public ContentDisposition getContentDisposition() {
String contentDisposition = getFirst(CONTENT_DISPOSITION);
if (contentDisposition != null) {
if (StringUtils.hasText(contentDisposition)) {
return ContentDisposition.parse(contentDisposition);
}
return ContentDisposition.empty();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册