-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tests for issue #687 #688
base: master
Are you sure you want to change the base?
tests for issue #687 #688
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,7 @@ public static void before() { | |
public void testBackslash() throws Exception { | ||
System.clearProperty("mail.mime.windowsfilenames"); | ||
ParameterList pl = new ParameterList("; filename=\"\\a\\b\\c.txt\""); | ||
assertEquals(pl.get("filename"), "abc.txt"); | ||
assertEquals("abc.txt", pl.get("filename")); | ||
} | ||
|
||
/** | ||
|
@@ -71,4 +71,33 @@ public void testLongSet() throws Exception { | |
assertTrue(pls.indexOf("p*0=") >= 0); | ||
assertTrue(pls.indexOf("p*1=") >= 0); | ||
} | ||
|
||
@Test | ||
public void testUtf8() throws Exception { | ||
String disposition = ";\n" + | ||
" filename*0*=utf-8''XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX--111111111-XXXXXXXXXXX;\n" + | ||
" filename*1*=XXXXXXXXXXXXXXXXXXXXXXXXXXX.pdf"; | ||
ParameterList parameterList = new ParameterList(disposition); | ||
assertEquals("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX--111111111-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.pdf", parameterList.get("filename")); | ||
} | ||
|
||
@Test | ||
public void testQEncoding() throws Exception { | ||
String disposition = ";\n" + | ||
" filename==?utf-8?Q?XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX--111111111-XXXXXXXXXXXXXXXXXXX?=\n" + | ||
" =?utf-8?Q?XXXXXXXXXXXXXXXXXXX=2Epdf?=;"; | ||
ParameterList parameterList = new ParameterList(disposition); | ||
assertEquals("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX--111111111-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.pdf", parameterList.get("filename")); | ||
} | ||
|
||
@Test | ||
public void testQEncodingAndUtf8() throws Exception { | ||
String disposition = ";\n" + | ||
" filename==?utf-8?Q?XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX--111111111-XXXXXXXXXXXXXXXXXXX?=\n" + | ||
" =?utf-8?Q?XXXXXXXXXXXXXXXXXXX=2Epdf?=;\n" + | ||
" filename*0*=utf-8''XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX--111111111-XXXXXXXXXXX;\n" + | ||
" filename*1*=XXXXXXXXXXXXXXXXXXXXXXXXXXX.pdf"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this could probably be handled in a way that if there is a valid variant of the parameter then ignore (and just log) the invalid one in non-string operation mode or through some new, different property. An implementation of this would probably need adding a property to |
||
ParameterList parameterList = new ParameterList(disposition); | ||
assertEquals("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX--111111111-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.pdf", parameterList.get("filename")); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filename==?utf-8?Q?X...
is invalid - it is missing*
, it should befilename*==?utf-8?Q?X...
, so the failure here is actually correct behaviour