Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensure that multipart/* parts always have a non-null boundary field #1381

Merged
merged 1 commit into from
May 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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