Add missing space in MIME header

Also skip adding the filename if none exists

b/13138456

Change-Id: I2e3d82c2a560049cfc3fcd0130f4c6d8020757a2
(cherry picked from commit 8b80821645)
This commit is contained in:
Tony Mantler 2014-05-19 15:05:07 -07:00 committed by Martin Hibdon
parent 5c5ed8f14a
commit ee818ac898

View File

@ -512,8 +512,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);