do not remove equal sign at the end of armored body when missing checksum

This commit is contained in:
Tom James Holub 2017-07-21 17:39:19 -07:00
parent ac055d69d2
commit 3f40a36081

View File

@ -237,14 +237,15 @@ function verifyHeaders(headers) {
* and an attribute "checksum" containing the checksum. * and an attribute "checksum" containing the checksum.
*/ */
function splitChecksum(text) { function splitChecksum(text) {
text = text.trim();
var body = text; var body = text;
var checksum = ""; var checksum = "";
var lastEquals = text.lastIndexOf("="); var lastEquals = text.lastIndexOf("=");
if (lastEquals >= 0) { if (lastEquals >= 0 && lastEquals !== text.length - 1) { // '=' as the last char means no checksum
body = text.slice(0, lastEquals); body = text.slice(0, lastEquals);
checksum = text.slice(lastEquals + 1).trim().substr(0, 4); checksum = text.slice(lastEquals + 1).substr(0, 4);
} }
return { body: body, checksum: checksum }; return { body: body, checksum: checksum };