Skip to content

Commit

Permalink
Should store the disposition-type without Content-Disposition paramet…
Browse files Browse the repository at this point in the history
…ers.
  • Loading branch information
jca02266 committed Apr 3, 2011
1 parent 39e3aec commit 37303d6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/com/fsck/k9/mail/store/LocalStore.java
Expand Up @@ -2368,6 +2368,14 @@ public Void doDbWork(final SQLiteDatabase db) throws WrappedException, Unavailab
String contentId = MimeUtility.getHeaderParameter(attachment.getContentId(), null);

String contentDisposition = MimeUtility.unfoldAndDecode(attachment.getDisposition());
String dispositionType = contentDisposition;

int pos = dispositionType.indexOf(';');

This comment has been minimized.

Copy link
@jca02266

jca02266 Apr 9, 2011

Author Contributor

Oops, the dispositionType may be null.

This comment has been minimized.

Copy link
@jca02266

jca02266 Apr 9, 2011

Author Contributor

Fixed by 2cd178e

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) {
name = MimeUtility.getHeaderParameter(contentDisposition, "filename");
}
Expand All @@ -2380,7 +2388,7 @@ public Void doDbWork(final SQLiteDatabase db) throws WrappedException, Unavailab
cv.put("name", name);
cv.put("mime_type", attachment.getMimeType());
cv.put("content_id", contentId);
cv.put("content_disposition", contentDisposition);
cv.put("content_disposition", dispositionType);

attachmentId = db.insert("attachments", "message_id", cv);
} else {
Expand Down

0 comments on commit 37303d6

Please sign in to comment.