mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 11:42:16 -05:00
Issue 190
Handle uppercase MIME type sent by non-compliant MUAs such as Pine.
This commit is contained in:
parent
b50a782c1c
commit
2c51862087
@ -81,7 +81,7 @@ public class MimeBodyPart extends BodyPart {
|
||||
if (contentType == null) {
|
||||
return "text/plain";
|
||||
} else {
|
||||
return contentType;
|
||||
return contentType.toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ public class MimeMessage extends Message {
|
||||
if (contentType == null) {
|
||||
return "text/plain";
|
||||
} else {
|
||||
return contentType;
|
||||
return contentType.toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.regex.Pattern;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
|
||||
@ -196,7 +197,9 @@ public class MimeUtility {
|
||||
* @return
|
||||
*/
|
||||
public static boolean mimeTypeMatches(String mimeType, String matchAgainst) {
|
||||
return mimeType.matches(matchAgainst.replaceAll("\\*", "\\.\\*"));
|
||||
Pattern p = Pattern.compile(matchAgainst.replaceAll("\\*", "\\.\\*"),
|
||||
Pattern.CASE_INSENSITIVE);
|
||||
return p.matcher(mimeType).matches();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -208,9 +211,9 @@ public class MimeUtility {
|
||||
*/
|
||||
public static boolean mimeTypeMatches(String mimeType, String[] matchAgainst) {
|
||||
for (String matchType : matchAgainst) {
|
||||
if (mimeType.matches(matchType.replaceAll("\\*", "\\.\\*"))) {
|
||||
return true;
|
||||
}
|
||||
if (mimeTypeMatches(mimeType, matchType)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user