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

This commit is contained in:
fisch0920 2014-05-07 02:00:17 -04:00
parent 57b57522bb
commit 4f002d7a76
1 changed files with 3 additions and 3 deletions

View File

@ -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()
}