diff --git a/index.js b/index.js index d5494ff..21867dc 100644 --- a/index.js +++ b/index.js @@ -399,6 +399,10 @@ function Client (peerId, port, torrent, opts) { self._numWant = self._opts.numWant || 80 self._intervalMs = self._opts.interval || (30 * 60 * 1000) // default: 30 minutes + if (typeof torrent.announce === 'string') { + // magnet-uri returns a string if the magnet uri only contains one 'tr' parameter + torrent.announce = [torrent.announce] + } self._trackers = torrent.announce.map(function (announceUrl) { return new Tracker(self, announceUrl, self._opts) }) diff --git a/test/client-large-torrent.js b/test/client-large-torrent.js index 62c5f03..c21950b 100644 --- a/test/client-large-torrent.js +++ b/test/client-large-torrent.js @@ -11,7 +11,7 @@ var port = 6881 // remove all tracker servers except a single UDP one, for now parsedTorrent.announce = [ 'udp://tracker.publicbt.com:80/announce' ] -test('client.start()', function (t) { +test('large torrent: client.start()', function (t) { t.plan(4) var client = new Client(peerId, port, parsedTorrent)