mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-24 08:38:51 -05:00
Avoid NullPointerException.
The name parameter in Content-Type may be not set.
This commit is contained in:
parent
90a5ca8ec2
commit
a4f7288d37
@ -1672,20 +1672,22 @@ public class LocalStore extends Store implements Serializable {
|
||||
body = new LocalAttachmentBody(Uri.parse(contentUri), mApplication);
|
||||
}
|
||||
|
||||
String encoded_name = EncoderUtil.encodeIfNecessary(name,
|
||||
EncoderUtil.Usage.WORD_ENTITY, 7);
|
||||
|
||||
MimeBodyPart bp = new LocalAttachmentBodyPart(body, id);
|
||||
bp.setHeader(MimeHeader.HEADER_CONTENT_TYPE,
|
||||
String.format("%s;\n name=\"%s\"",
|
||||
type,
|
||||
encoded_name));
|
||||
bp.setHeader(MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING, "base64");
|
||||
bp.setHeader(MimeHeader.HEADER_CONTENT_DISPOSITION,
|
||||
String.format("%s;\n filename=\"%s\";\n size=%d",
|
||||
contentDisposition,
|
||||
encoded_name, // TODO: Should use encoded word defined in RFC 2231.
|
||||
size));
|
||||
if (name != null) {
|
||||
String encoded_name = EncoderUtil.encodeIfNecessary(name,
|
||||
EncoderUtil.Usage.WORD_ENTITY, 7);
|
||||
|
||||
bp.setHeader(MimeHeader.HEADER_CONTENT_TYPE,
|
||||
String.format("%s;\n name=\"%s\"",
|
||||
type,
|
||||
encoded_name));
|
||||
bp.setHeader(MimeHeader.HEADER_CONTENT_DISPOSITION,
|
||||
String.format("%s;\n filename=\"%s\";\n size=%d",
|
||||
contentDisposition,
|
||||
encoded_name, // TODO: Should use encoded word defined in RFC 2231.
|
||||
size));
|
||||
}
|
||||
|
||||
bp.setHeader(MimeHeader.HEADER_CONTENT_ID, contentId);
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user