Filter Attachment file name of forward slashes for .eml attachments.
Bug: b/66230183
Change-Id: I6715358a07bc5bd9de6ee877b4a235a974767536
(cherry picked from commit 53b40fd185517ca82a0c4305570c5a5e3b83abf0)
diff --git a/src/com/android/mail/providers/Attachment.java b/src/com/android/mail/providers/Attachment.java
index b8e86ed..af4b3e3 100644
--- a/src/com/android/mail/providers/Attachment.java
+++ b/src/com/android/mail/providers/Attachment.java
@@ -245,6 +245,11 @@
name = MimeUtility.getHeaderParameter(contentDisposition, "filename");
}
+ // Prevent passing in a file path as part of the name.
+ if (name != null) {
+ name = name.replace('/', '_');
+ }
+
contentType = MimeType.inferMimeType(name, part.getMimeType());
uri = EmlAttachmentProvider.getAttachmentUri(emlFileUri, messageId, cid);
contentUri = uri;