Open Bug 1717137 Opened 3 years ago Updated 3 years ago

POP3 message download applies mbox "From " escaping. It shouldn't.

Categories

(MailNews Core :: Backend, defect)

defect

Tracking

(Not tracked)

ASSIGNED

People

(Reporter: benc, Assigned: benc)

References

(Blocks 1 open bug)

Details

The chunk of code which downloads POP3 messages applies mbox "From " escaping. This should be a detail entirely dealt with inside the mbox mailstore (and not maildir or any others).

Haven't actually replicated it, but the fault seems pretty clear in the code:
https://searchfox.org/comm-central/source/mailnews/local/src/nsPop3Sink.cpp#595

nsresult nsPop3Sink::IncorporateWrite(const char* block, int32_t length) {
  m_outputBuffer.Truncate();
  if (!strncmp(block, "From ", 5)) m_outputBuffer.Assign('>');

  m_outputBuffer.Append(block);

  return WriteLineToMailbox(m_outputBuffer);
}

Resolution of this bug should include a test to ensure messages containing body lines starting with "From " are handled correctly when POP3 messages are being placed into a maildir store.
Should also check that "From "-escaped lines are never seen outside the mbox store.

Assignee: nobody → benc

Consider that save as EML will require removing the escaping if stored in an MBOX and dragging an EML into an mbox folder is going to require the escaping. Perhaps this is a messy issue.

Yeah, I have noticed such escaping in pop3 sporadically but never had a chance to dig into it.

(In reply to Matt from comment #2)

Consider that save as EML will require removing the escaping if stored in an MBOX and dragging an EML into an mbox folder is going to require the escaping. Perhaps this is a messy issue.

Yup, it's messy :-) But it'll be way less messy when I'm done with it.
In my ideal world the "From "-escaping should just be an implementation detail hidden away inside the mbox store code.
So save-to-eml (to use your example) would just ask for the message and just stream the results out to a file verbatim. The message itself might be fetched from local storage (mbox or maildir) or via the network (imap, nntp, etc), but the save-to-eml doesn't need to know or care.

There's a lot of "From " handling code dotted about the place, so the messy bit is excising all that from the various parsing code and moving it down into the mbox store.

Blocks: 1719121
Status: NEW → ASSIGNED
You need to log in before you can comment on or make changes to this bug.