Ensure infoHash is lowercase

This commit is contained in:
Feross Aboukhadijeh 2018-04-20 18:23:43 -07:00
parent e782ff382b
commit 3ec7aace26

View File

@ -51,7 +51,7 @@ function Client (opts) {
self._peerIdBinary = self._peerIdBuffer.toString('binary') self._peerIdBinary = self._peerIdBuffer.toString('binary')
self.infoHash = typeof opts.infoHash === 'string' self.infoHash = typeof opts.infoHash === 'string'
? opts.infoHash ? opts.infoHash.toLowerCase()
: opts.infoHash.toString('hex') : opts.infoHash.toString('hex')
self._infoHashBuffer = Buffer.from(self.infoHash, 'hex') self._infoHashBuffer = Buffer.from(self.infoHash, 'hex')
self._infoHashBinary = self._infoHashBuffer.toString('binary') self._infoHashBinary = self._infoHashBuffer.toString('binary')