Redefine Regex for blank line after armor header. This fixes an issue with truncated blank lines at the beginning of cleartext signed messages.
This commit is contained in:
parent
f41e644259
commit
172855a8e9
|
@ -211,7 +211,8 @@ function createcrc24(input) {
|
||||||
* and an attribute "body" containing the body.
|
* and an attribute "body" containing the body.
|
||||||
*/
|
*/
|
||||||
function splitHeaders(text) {
|
function splitHeaders(text) {
|
||||||
var reEmptyLine = /^\s*\n/m;
|
// empty line with whitespace characters
|
||||||
|
var reEmptyLine = /^[ \f\r\t\u00a0\u2000-\u200a\u202f\u205f\u3000]*\n/m;
|
||||||
var headers = '';
|
var headers = '';
|
||||||
var body = text;
|
var body = text;
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ describe("ASCII armor", function() {
|
||||||
var msg =
|
var msg =
|
||||||
['-----BEGIN PGP SIGNED MESSAGE-----',
|
['-----BEGIN PGP SIGNED MESSAGE-----',
|
||||||
'Hash: SHA1',
|
'Hash: SHA1',
|
||||||
'\u000b\u00a0',
|
' \f\r\t\u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000',
|
||||||
'sign this',
|
'sign this',
|
||||||
'-----BEGIN PGP SIGNATURE-----',
|
'-----BEGIN PGP SIGNATURE-----',
|
||||||
'Version: GnuPG v2.0.22 (GNU/Linux)',
|
'Version: GnuPG v2.0.22 (GNU/Linux)',
|
||||||
|
@ -183,6 +183,12 @@ describe("ASCII armor", function() {
|
||||||
expect(result.keys[0]).to.be.an.instanceof(openpgp.key.Key);
|
expect(result.keys[0]).to.be.an.instanceof(openpgp.key.Key);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Do not filter blank lines after header', function () {
|
||||||
|
var msg = getArmor(['Hash: SHA1', '']);
|
||||||
|
msg = openpgp.cleartext.readArmored(msg);
|
||||||
|
expect(msg.text).to.equal('\r\nsign this');
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user