Skip to content

Commit

Permalink
ensure that multipart/* parts always have a non-null boundary field
Browse files Browse the repository at this point in the history
  • Loading branch information
Valodim committed May 19, 2016
1 parent f4628d2 commit e3593a1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public MimeMultipart(String mimeType, String boundary) throws MessagingException
this.boundary = boundary;
}

public String generateBoundary() {
public static String generateBoundary() {
Random random = new Random();
StringBuilder sb = new StringBuilder();
sb.append("----");
Expand Down
6 changes: 5 additions & 1 deletion k9mail/src/main/java/com/fsck/k9/mailstore/LocalFolder.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@
import com.fsck.k9.mailstore.LockableDatabase.DbCallback;
import com.fsck.k9.mailstore.LockableDatabase.WrappedException;
import com.fsck.k9.message.extractors.AttachmentInfoExtractor;
import com.fsck.k9.message.extractors.MessageFulltextCreator;
import com.fsck.k9.message.extractors.MessagePreviewCreator;
import com.fsck.k9.message.extractors.PreviewResult;
import com.fsck.k9.message.extractors.PreviewResult.PreviewType;
import com.fsck.k9.message.extractors.MessageFulltextCreator;
import com.fsck.k9.preferences.Storage;
import com.fsck.k9.preferences.StorageEditor;
import org.apache.commons.io.IOUtils;
Expand Down Expand Up @@ -1405,6 +1405,10 @@ private void missingPartToContentValues(ContentValues cv, Part part) throws Mess
cv.put("display_name", attachment.displayName);
cv.put("data_location", DataLocation.MISSING);
cv.put("decoded_body_size", attachment.size);

if (MimeUtility.isMultipart(part.getMimeType())) {
cv.put("boundary", MimeMultipart.generateBoundary());
}
}

private void messageMarkerToContentValues(ContentValues cv) throws MessagingException {
Expand Down

0 comments on commit e3593a1

Please sign in to comment.