diff --git a/bencoder.js b/bencoder.js index ba46577..6ce1071 100644 --- a/bencoder.js +++ b/bencoder.js @@ -97,7 +97,7 @@ var decoderProto = { while(intValue === undefined) { let chr; while(this.position < this.input.length && (chr = this.input[this.position ++]) !== END_OF_TYPE) { - if(chr < 48 || chr > 57) this.throwError('Invalid integer value', chr, this.position - 1); + if ((chr < 48 || chr > 57) && (chr != 45)) this.throwError('Invalid integer value', chr, this.position - 1); } if(chr === END_OF_TYPE) { intValue = + this.input.slice(offset, this.position - 1).toString(); @@ -211,4 +211,4 @@ module.exports = { return decoder; }, encoder: encoder //state-less -}; \ No newline at end of file +};