Remove Jakarta Mail dependency from spring-web

This commit removes the dependency that the spring-web module has on
Jakarta Mail.

In FormHttpMessageConverter, a dependency on
jakarta.mail.internet.MimeUtility was replaced by existing encoding
logic in ContentDisposition.

In StandardMultipartHttpServletRequest, a dependency on the same
MimeUtility was replaced by new quoted-printable decoding logic in
ContentDisposition.

Closes gh-28392
This commit is contained in:
Arjen Poutsma
2022-04-28 15:21:58 +02:00
parent b4e6014a14
commit 217117ced0
5 changed files with 78 additions and 55 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -92,6 +92,18 @@ class ContentDispositionTests {
assertThat(parse(input).getFilename()).isEqualTo("日本語.csv");
}
@Test
void parseQuotedPrintableFilename() {
String input = "attachment; filename=\"=?UTF-8?Q?=E6=97=A5=E6=9C=AC=E8=AA=9E.csv?=\"";
assertThat(parse(input).getFilename()).isEqualTo("日本語.csv");
}
@Test
void parseQuotedPrintableShiftJISFilename() {
String input = "attachment; filename=\"=?SHIFT_JIS?Q?=93=FA=96{=8C=EA.csv?=\"";
assertThat(parse(input).getFilename()).isEqualTo("日本語.csv");
}
@Test
void parseEncodedFilenameWithoutCharset() {
assertThat(parse("form-data; name=\"name\"; filename*=test.txt"))