1
0
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:
cketti 2012-06-18 04:46:46 +02:00
parent ee1288ee75
commit 602ce7be99
2 changed files with 4 additions and 1 deletions

View File

@ -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))) {

View File

@ -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);
}
}