Closed Bug 1744167 Opened 3 years ago Closed 3 years ago

nsIMsgLocalMailFolder.addMessageBatch() skips last line of message without line endings

Categories

(MailNews Core :: Backend, defect)

defect

Tracking

(thunderbird_esr91 wontfix)

RESOLVED FIXED
97 Branch
Tracking Status
thunderbird_esr91 --- wontfix

People

(Reporter: benc, Assigned: benc)

References

Details

Attachments

(2 files)

The implementation of nsIMsgLocalMailFolder.addMessageBatch() was leaving off the trailing line of any messages without a final line ending.
It uses nsParseNewMailState, which reads messages line-by-line (it's derived from nsMsgLineBuffer). But it only processes lines with a line ending. To process anything left over, Flush() needs to be called, and addMessageBatch() doens't do that.

addMessageBatch() is only used by test code.
Some generated test messages don't have a trailing line ending, although I think that it is masked elsewhere, where a synthetic '\n' is added.

addMessageBatch() was leaving off the trailing line of any messages without
a final line ending. It uses nsParseNewMailState (derived from
nsMsgLineBuffer), which doesn't process trailing data unless
nsMsgLineBuffer::Flush() is called.
This patch also fixes nsMsgLineBuffer::Flush().

Summary: nsIMsgLocalMailFolder.addMessageBatch() → nsIMsgLocalMailFolder.addMessageBatch() skips last line of message without line endings
Status: NEW → ASSIGNED
Target Milestone: --- → 97 Branch

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/c1f290667663
Fix test_ext_messages_get.js to not rely on synthesised LF in test message. r=mkmelin
https://hg.mozilla.org/comm-central/rev/9014e82d837d
Fix nsIMsgLocalMailFolder addMessageBatch() for messages without trailing CRLF. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Keywords: leave-open
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: