Add missing space in MIME header

Also skip adding the filename if none exists

b/13138456

Change-Id: I2e3d82c2a560049cfc3fcd0130f4c6d8020757a2
This commit is contained in:
Tony Mantler 2014-05-19 15:05:07 -07:00
parent 81ff6fae02
commit 8b80821645

View File

@ -475,8 +475,8 @@ public class LegacyConversions {
final Base64Body body = new Base64Body(content);
final MimeBodyPart bp = new MimeBodyPart(body, contentType);
bp.setHeader(MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING, "base64");
bp.setHeader(MimeHeader.HEADER_CONTENT_DISPOSITION, "attachment;\n"
+ "filename=\"" + filename + "\";"
bp.setHeader(MimeHeader.HEADER_CONTENT_DISPOSITION, "attachment;\n "
+ (!TextUtils.isEmpty(filename) ? "filename=\"" + filename + "\";" : "")
+ "size=" + contentSize);
if (contentId != null) {
bp.setHeader(MimeHeader.HEADER_CONTENT_ID, contentId);