improved armor behavior - trailing newline
This commit is contained in:
parent
80742bdfbe
commit
841b03d6cd
|
@ -246,10 +246,7 @@ function splitChecksum(text) {
|
||||||
|
|
||||||
if (lastEquals >= 0) {
|
if (lastEquals >= 0) {
|
||||||
body = text.slice(0, lastEquals);
|
body = text.slice(0, lastEquals);
|
||||||
checksum = text.slice(lastEquals + 1);
|
checksum = text.slice(lastEquals + 1).trim().substr(0, 4);
|
||||||
if (checksum.substr(0, 6) === '\n-----') {
|
|
||||||
checksum = ''; // missing armor checksum
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return { body: body, checksum: checksum };
|
return { body: body, checksum: checksum };
|
||||||
|
@ -271,6 +268,7 @@ function dearmor(text) {
|
||||||
|
|
||||||
var type = getType(text);
|
var type = getType(text);
|
||||||
|
|
||||||
|
text = text.trim() + "\n";
|
||||||
var splittext = text.split(reSplit);
|
var splittext = text.split(reSplit);
|
||||||
|
|
||||||
// IE has a bug in split with a re. If the pattern matches the beginning of the
|
// IE has a bug in split with a re. If the pattern matches the beginning of the
|
||||||
|
@ -312,8 +310,6 @@ function dearmor(text) {
|
||||||
checksum = sig_sum.checksum;
|
checksum = sig_sum.checksum;
|
||||||
}
|
}
|
||||||
|
|
||||||
checksum = checksum.substr(0, 4);
|
|
||||||
|
|
||||||
if (!verifyCheckSum(result.data, checksum) && (checksum || config.checksum_required)) {
|
if (!verifyCheckSum(result.data, checksum) && (checksum || config.checksum_required)) {
|
||||||
// will NOT throw error if checksum is empty AND checksum is not required (GPG compatibility)
|
// will NOT throw error if checksum is empty AND checksum is not required (GPG compatibility)
|
||||||
throw new Error("Ascii armor integrity check on message failed: '" + checksum + "' should be '" +
|
throw new Error("Ascii armor integrity check on message failed: '" + checksum + "' should be '" +
|
||||||
|
|
Loading…
Reference in New Issue
Block a user