1
0
mirror of https://github.com/moparisthebest/k-9 synced 2025-02-25 15:11:52 -05:00

It turns out that 79a96952f2b8c95c059afee3e564721a09ed98c1 has caused a

lot of messages to be unreadable in K-9 3.8.  (see mailing list
threads)
This commit is contained in:
Jesse Vincent 2011-06-09 21:54:22 -04:00
parent c416f02d52
commit 379a8dfa9e
2 changed files with 5 additions and 11 deletions

View File

@ -1139,9 +1139,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
*/ */
bp.addHeader(MimeHeader.HEADER_CONTENT_DISPOSITION, String.format( bp.addHeader(MimeHeader.HEADER_CONTENT_DISPOSITION, String.format(
"attachment;\n filename=\"%s\";\n size=%d", "attachment;\n filename=\"%s\";\n size=%d",
EncoderUtil.encodeIfNecessary(attachment.name, attachment.name, attachment.size));
EncoderUtil.Usage.WORD_ENTITY, 7),
attachment.size));
mp.addBodyPart(bp); mp.addBodyPart(bp);
} }

View File

@ -18,7 +18,6 @@ import java.util.regex.Pattern;
import com.fsck.k9.helper.HtmlConverter; import com.fsck.k9.helper.HtmlConverter;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.james.mime4j.codec.EncoderUtil;
import android.app.Application; import android.app.Application;
import android.content.ContentValues; import android.content.ContentValues;
@ -1670,17 +1669,14 @@ public class LocalStore extends Store implements Serializable {
MimeBodyPart bp = new LocalAttachmentBodyPart(body, id); MimeBodyPart bp = new LocalAttachmentBodyPart(body, id);
bp.setHeader(MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING, "base64"); bp.setHeader(MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING, "base64");
if (name != null) { if (name != null) {
String encoded_name = EncoderUtil.encodeIfNecessary(name,
EncoderUtil.Usage.WORD_ENTITY, 7);
bp.setHeader(MimeHeader.HEADER_CONTENT_TYPE, bp.setHeader(MimeHeader.HEADER_CONTENT_TYPE,
String.format("%s;\n name=\"%s\"", String.format("%s;\n name=\"%s\"",
type, type,
encoded_name)); name));
bp.setHeader(MimeHeader.HEADER_CONTENT_DISPOSITION, bp.setHeader(MimeHeader.HEADER_CONTENT_DISPOSITION,
String.format("%s;\n filename=\"%s\";\n size=%d", String.format("%s;\n filename=\"%s\";\n size=%d",
contentDisposition, contentDisposition,
encoded_name, // TODO: Should use encoded word defined in RFC 2231. name, // TODO: Should use encoded word defined in RFC 2231.
size)); size));
} }
@ -2383,7 +2379,7 @@ public class LocalStore extends Store implements Serializable {
Utility.combine(attachment.getHeader( Utility.combine(attachment.getHeader(
MimeHeader.HEADER_ANDROID_ATTACHMENT_STORE_DATA), ','); MimeHeader.HEADER_ANDROID_ATTACHMENT_STORE_DATA), ',');
String name = MimeUtility.unfoldAndDecode(MimeUtility.getHeaderParameter(attachment.getContentType(), "name")); String name = MimeUtility.getHeaderParameter(attachment.getContentType(), "name");
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());
@ -2398,7 +2394,7 @@ public class LocalStore extends Store implements Serializable {
} }
if (name == null && contentDisposition != null) { if (name == null && contentDisposition != null) {
name = MimeUtility.unfoldAndDecode(MimeUtility.getHeaderParameter(contentDisposition, "filename")); name = MimeUtility.getHeaderParameter(contentDisposition, "filename");
} }
if (attachmentId == -1) { if (attachmentId == -1) {
ContentValues cv = new ContentValues(); ContentValues cv = new ContentValues();