diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2015-03-01 00:56:36 +0300 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2015-03-01 00:56:36 +0300 |
commit | a44506e679b5c4ac7341bbb3ef277e2c092362e9 (patch) | |
tree | a4f98434c0642f4abbb4d5e10be033b4304e3d2e /bin/cmd.js | |
parent | f252d16df4a6142cb2a65d02b5014e92bb88b53c (diff) |
parse-torrent@4
Diffstat (limited to 'bin/cmd.js')
-rwxr-xr-x | bin/cmd.js | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -142,7 +142,14 @@ function runHelp () { } function runInfo (torrentId) { - var parsedTorrent = parseTorrent(torrentId) + var parsedTorrent + try { + parsedTorrent = parseTorrent(torrentId) + } catch (err) { + // If torrent fails to parse, it could be a filesystem path, so don't consider it + // an error yet. + } + if (!parsedTorrent || !parsedTorrent.infoHash) { try { parsedTorrent = parseTorrent(fs.readFileSync(torrentId)) @@ -150,7 +157,6 @@ function runInfo (torrentId) { errorAndExit(err) } } - if (!parsedTorrent) errorAndExit('Invalid torrent identifier') delete parsedTorrent.info delete parsedTorrent.infoBuffer |