From 4f002d7a76a20f66f23be5def53f901775958e62 Mon Sep 17 00:00:00 2001 From: fisch0920 Date: Wed, 7 May 2014 02:00:17 -0400 Subject: [PATCH] fixed issue where ut_metadata thought it should have the whole torrent metadata whereas it actually only has the info dictionary part of the metadata --- index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 39afa50..f84c686 100644 --- a/index.js +++ b/index.js @@ -179,13 +179,13 @@ module.exports = function (metadata) { // check hash var info try { - info = bncode.encode(bncode.decode(this.metadata).info) + info = bncode.encode(bncode.decode(this.metadata)) } catch (err) { // if buffer fails to decode, then data was corrupt return this._failedMetadata() } - if (sha1(info) === this._infoHash.toString('hex')) { - this._gotMetadata(this.metadata) + if (info && sha1(info) === this._infoHash.toString('hex')) { + this._gotMetadata(bncode.encode({ info : bncode.decode(this.metadata) })) } else { this._failedMetadata() }