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:
parent
57b57522bb
commit
4f002d7a76
6
index.js
6
index.js
|
@ -179,13 +179,13 @@ module.exports = function (metadata) {
|
||||||
// check hash
|
// check hash
|
||||||
var info
|
var info
|
||||||
try {
|
try {
|
||||||
info = bncode.encode(bncode.decode(this.metadata).info)
|
info = bncode.encode(bncode.decode(this.metadata))
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// if buffer fails to decode, then data was corrupt
|
// if buffer fails to decode, then data was corrupt
|
||||||
return this._failedMetadata()
|
return this._failedMetadata()
|
||||||
}
|
}
|
||||||
if (sha1(info) === this._infoHash.toString('hex')) {
|
if (info && sha1(info) === this._infoHash.toString('hex')) {
|
||||||
this._gotMetadata(this.metadata)
|
this._gotMetadata(bncode.encode({ info : bncode.decode(this.metadata) }))
|
||||||
} else {
|
} else {
|
||||||
this._failedMetadata()
|
this._failedMetadata()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue