mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 18:02:15 -05:00
Trim the first value in getHeaderParameters()
Previously a value like 'text/html ; charset="windows-1251"' for the Content-Type header would not be decoded correctly. Fixes issue 4348
This commit is contained in:
parent
ee1288ee75
commit
602ce7be99
@ -956,7 +956,7 @@ public class MimeUtility {
|
||||
header = header.replaceAll("\r|\n", "");
|
||||
String[] parts = header.split(";");
|
||||
if (name == null && parts.length > 0) {
|
||||
return parts[0];
|
||||
return parts[0].trim();
|
||||
}
|
||||
for (String part : parts) {
|
||||
if (part.trim().toLowerCase(Locale.US).startsWith(name.toLowerCase(Locale.US))) {
|
||||
|
@ -35,5 +35,8 @@ public class MimeUtilityTest extends AndroidTestCase {
|
||||
|
||||
result = MimeUtility.getHeaderParameter("name=\"\"", "name");
|
||||
assertEquals("", result);
|
||||
|
||||
result = MimeUtility.getHeaderParameter("text/html ; charset=\"windows-1251\"", null);
|
||||
assertEquals("text/html", result);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user