Make jsmime eat TABs when stripcontinuations is enabled
Categories
(MailNews Core :: MIME, task)
Tracking
(Not tracked)
People
(Reporter: TbSync, Unassigned)
Details
The headers returned by jsmime differ from those returned by Thunderbirds main mime parser: If a header is stretching accross multiple lines by \r\n\t, jsmime is keeping the TAB instead of turning it into a space.
I think this is happening here:
https://searchfox.org/comm-central/rev/305f9063e0402cb76e14b7986fcb5567839d4946/mailnews/mime/jsmime/jsmime.js#1800
Could we align our two implementations?
Comment 1•2 years ago
|
||
(In reply to John Bieling (:TbSync) from comment #0)
Could we align our two implementations?
The only thing against it is probably the unnecessary runtime. Whereby the effort is rather minimal.
But I don't see any advantage of it either. Do the tabs bother you in any way?
When displaying a mail, StructuredHeaders()
is called twice. First with stripcontinuations=TRUE
:
StructuredHeaders (resource:///modules/jsmime/jsmime.js#1786)
_parseHeaders (resource:///modules/jsmime/jsmime.js#2535)
_dispatchEOF (resource:///modules/jsmime/jsmime.js#2501)
deliverEOF (resource:///modules/jsmime/jsmime.js#2246)
parseSync (resource:///modules/mimeParser.jsm#327)
extractHeaders (resource:///modules/mimeParser.jsm#442)
initialize (resource:///modules/MimeJSComponents.jsm#157)
The call is likely to be used to set the function parameters of the article structure (charset, etc.).
The second call is made with stripcontinuations=FALSE
:
StructuredHeaders (resource:///modules/jsmime/jsmime.js#1786)
_parseHeaders (resource:///modules/jsmime/jsmime.js#2535)
_dispatchData (resource:///modules/jsmime/jsmime.js#2381)
deliverData (resource:///modules/jsmime/jsmime.js#2209)
getMimeTree (chrome://openpgp/content/modules/mime.jsm#566)
onData (chrome://openpgp/content/modules/mime.jsm#461)
onStopRequest (chrome://openpgp/content/modules/streams.jsm#61)
The headers to be displayed are extracted. When removing the MIME encoding, the headers are also unfolded and the TABs are removed correctly.
Comment 2•2 years ago
|
||
(In reply to Alfred Peters from comment #1)
The only thing against it is probably the unnecessary runtime. Whereby the effort is rather minimal.
Possible patch:
if (options.stripcontinuations) {
- val = val.replace(/[\r\n]/g, "");
+ val = val.replace(/[\r\n]\t/g, " ").replace(/[\r\n]/g, "");
}
Description
•