quentez / talonjs

JavaScript port of the Talon email quote parsing library.
MIT License
15 stars 9 forks source link

Return forwarded messages intact (without removing the forwarded content) #37

Closed khennes closed 4 years ago

khennes commented 4 years ago

Follow-up to #36: if we find that a message was forwarded, we stop processing it and return it intact; we also avoid using the non-checkpoints method to find quotes.

The intended behavior of talonjs is to consider a forwarded message part of the reply. It does this by checking if the message begins with any number of text markers or empty lines, followed by a line that matches the ForwardRegexp. If it does, then talonjs returns the message intact, without cutting any lines.

However, because talonjs will, as a last resort, strip out all known quotation tags if a quote isn't found by using the checkpoints method, this means that parts of forwarded messages (for which didFindQuote is always false) are still cut from the reply. (I've added a regression test to catch this: https://github.com/quentez/talonjs/compare/kh/preserve-forwards?expand=1#diff-0b32b5b5092982e9deccf54f38fa8763R383.)