1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-24 02:12:15 -05:00

Should store the disposition-type without Content-Disposition parameters.

This commit is contained in:
Koji Arai 2011-04-04 00:48:13 +09:00
parent 39e3aecf73
commit 37303d69d8

View File

@ -2368,6 +2368,14 @@ public class LocalStore extends Store implements Serializable {
String contentId = MimeUtility.getHeaderParameter(attachment.getContentId(), null); String contentId = MimeUtility.getHeaderParameter(attachment.getContentId(), null);
String contentDisposition = MimeUtility.unfoldAndDecode(attachment.getDisposition()); String contentDisposition = MimeUtility.unfoldAndDecode(attachment.getDisposition());
String dispositionType = contentDisposition;
int pos = dispositionType.indexOf(';');
if (pos != -1) {
// extract the disposition-type, "attachment", "inline" or extension-token (see the RFC 2183)
dispositionType = dispositionType.substring(0, pos);
}
if (name == null && contentDisposition != null) { if (name == null && contentDisposition != null) {
name = MimeUtility.getHeaderParameter(contentDisposition, "filename"); name = MimeUtility.getHeaderParameter(contentDisposition, "filename");
} }
@ -2380,7 +2388,7 @@ public class LocalStore extends Store implements Serializable {
cv.put("name", name); cv.put("name", name);
cv.put("mime_type", attachment.getMimeType()); cv.put("mime_type", attachment.getMimeType());
cv.put("content_id", contentId); cv.put("content_id", contentId);
cv.put("content_disposition", contentDisposition); cv.put("content_disposition", dispositionType);
attachmentId = db.insert("attachments", "message_id", cv); attachmentId = db.insert("attachments", "message_id", cv);
} else { } else {