always remove trailing whitespace from lines when canonicalizing
This commit is contained in:
parent
d785df3325
commit
c28f7ad4d7
|
@ -43,7 +43,7 @@ export function CleartextMessage(text, signature) {
|
|||
return new CleartextMessage(text, signature);
|
||||
}
|
||||
// normalize EOL to canonical form <CR><LF>
|
||||
this.text = text.replace(/\r/g, '').replace(/[\t ]+\n/g, "\n").replace(/\n/g, "\r\n");
|
||||
this.text = text.replace(/\r\n/g, "\n").replace(/\r/g, "\n").replace(/[ \t]+\n/g, "\n").replace(/\n/g, "\r\n");
|
||||
if (signature && !(signature instanceof Signature)) {
|
||||
throw new Error('Invalid signature input');
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ function Literal(date=new Date()) {
|
|||
*/
|
||||
Literal.prototype.setText = function(text) {
|
||||
// normalize EOL to \r\n
|
||||
text = text.replace(/\r\n/g, '\n').replace(/\r/g, '\n').replace(/\n/g, '\r\n');
|
||||
text = text.replace(/\r\n/g, "\n").replace(/\r/g, "\n").replace(/[ \t]+\n/g, "\n").replace(/\n/g, "\r\n");
|
||||
this.format = 'utf8';
|
||||
// encode UTF8
|
||||
this.data = util.str_to_Uint8Array(util.encode_utf8(text));
|
||||
|
|
Loading…
Reference in New Issue
Block a user