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 Base64Body body = new Base64Body(content);
final MimeBodyPart bp = new MimeBodyPart(body, contentType); final MimeBodyPart bp = new MimeBodyPart(body, contentType);
bp.setHeader(MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING, "base64"); bp.setHeader(MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING, "base64");
bp.setHeader(MimeHeader.HEADER_CONTENT_DISPOSITION, "attachment;\n" bp.setHeader(MimeHeader.HEADER_CONTENT_DISPOSITION, "attachment;\n "
+ "filename=\"" + filename + "\";" + (!TextUtils.isEmpty(filename) ? "filename=\"" + filename + "\";" : "")
+ "size=" + contentSize); + "size=" + contentSize);
if (contentId != null) { if (contentId != null) {
bp.setHeader(MimeHeader.HEADER_CONTENT_ID, contentId); bp.setHeader(MimeHeader.HEADER_CONTENT_ID, contentId);