Skip to content
This repository was archived by the owner on Feb 20, 2020. It is now read-only.

Commit e55eb48

Browse files
mobileAgentbshannon
authored andcommitted
issue #326 allow relaxed Content-Disposition to apply to Content-Disposition properties
1 parent e8451dd commit e55eb48

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

Diff for: doc/release/CHANGES.txt

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ GH 317 use System.lineSeparator() instead of System.getProperty(...)
3030
GH 321 URLName.getURL() returns incorrect url.
3131
GH 322 Dots in local part of emails not handled properly
3232
GH 323 Support loading protocol providers using ServiceLoader
33+
GH 326 Apply relaxed Content-Disposition parsing to Content-Disposition parameters
3334

3435

3536
CHANGES IN THE 1.6.1 RELEASE

Diff for: mail/src/main/java/javax/mail/internet/ContentDisposition.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,14 @@ public ContentDisposition(String s) throws ParseException {
105105
// Then parameters ..
106106
String rem = h.getRemainder();
107107
if (rem != null)
108-
list = new ParameterList(rem);
108+
try {
109+
list = new ParameterList(rem);
110+
} catch (ParseException px) {
111+
if (contentDispositionStrict) {
112+
throw px;
113+
}
114+
}
115+
}
109116
}
110117

111118
/**

Diff for: mail/src/test/java/javax/mail/internet/ContentDispositionNoStrict.java

+10
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,16 @@ public void testDecode() throws Exception {
6464
}
6565
}
6666

67+
@Test
68+
public void testDecodeWithParams() throws Exception {
69+
try {
70+
ContentDisposition cd = new ContentDisposition(" ; size=12345");
71+
assertNull("Content disposition must parse to null in non-strict mode", cd.getDisposition());
72+
} catch (ParseException px) {
73+
fail("Exception must not be thrown in non-strict mode");
74+
}
75+
}
76+
6777
@AfterClass
6878
public static void after() {
6979
System.clearProperty("mail.mime.contentdisposition.strict");

0 commit comments

Comments
 (0)