support split checksum where body and checksum are on the same line
This commit is contained in:
parent
ddf6eb5783
commit
a7702a74d3
|
@ -239,15 +239,14 @@ function verifyHeaders(headers) {
|
||||||
* and an attribute "checksum" containing the checksum.
|
* and an attribute "checksum" containing the checksum.
|
||||||
*/
|
*/
|
||||||
function splitChecksum(text) {
|
function splitChecksum(text) {
|
||||||
var reChecksumStart = /^=/m;
|
|
||||||
var body = text;
|
var body = text;
|
||||||
var checksum = "";
|
var checksum = "";
|
||||||
|
|
||||||
var matchResult = reChecksumStart.exec(text);
|
var lastEquals = text.lastIndexOf("=");
|
||||||
|
|
||||||
if (matchResult !== null) {
|
if (lastEquals >= 0) {
|
||||||
body = text.slice(0, matchResult.index);
|
body = text.slice(0, lastEquals);
|
||||||
checksum = text.slice(matchResult.index + 1);
|
checksum = text.slice(lastEquals + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return { body: body, checksum: checksum };
|
return { body: body, checksum: checksum };
|
||||||
|
|
Loading…
Reference in New Issue
Block a user