Merge pull request #557 from openpgpjs/decode_single_line
allow body + checksum on same line in splitChecksum
This commit is contained in:
commit
402e26d98c
|
@ -239,15 +239,14 @@ function verifyHeaders(headers) {
|
|||
* and an attribute "checksum" containing the checksum.
|
||||
*/
|
||||
function splitChecksum(text) {
|
||||
var reChecksumStart = /^=/m;
|
||||
var body = text;
|
||||
var checksum = "";
|
||||
|
||||
var matchResult = reChecksumStart.exec(text);
|
||||
var lastEquals = text.lastIndexOf("=");
|
||||
|
||||
if (matchResult !== null) {
|
||||
body = text.slice(0, matchResult.index);
|
||||
checksum = text.slice(matchResult.index + 1);
|
||||
if (lastEquals >= 0) {
|
||||
body = text.slice(0, lastEquals);
|
||||
checksum = text.slice(lastEquals + 1);
|
||||
}
|
||||
|
||||
return { body: body, checksum: checksum };
|
||||
|
|
Loading…
Reference in New Issue
Block a user