JohnDoee / autotorrent

Matches torrents with files and gets them seeded
MIT License
269 stars 34 forks source link

IndexError: index out of range #15

Closed ordinarygulp closed 6 years ago

ordinarygulp commented 6 years ago

Not sure what is causing this, but I'm getting this on some .torrent files:

Traceback (most recent call last):
  File "/usr/bin/autotorrent", line 11, in <module>
    load_entry_point('autotorrent==1.6.2', 'console_scripts', 'autotorrent')()
  File "/usr/lib64/python3.6/site-packages/autotorrent/cmd.py", line 214, in commandline_handler
    result = at.handle_torrentfile(os.path.join(current_path, torrent), dry_run)
  File "/usr/lib64/python3.6/site-packages/autotorrent/at.py", line 419, in handle_torrentfile
    torrent = self.open_torrentfile(path)
  File "/usr/lib64/python3.6/site-packages/autotorrent/at.py", line 484, in open_torrentfile
    return bdecode(f.read())
  File "/usr/lib64/python3.6/site-packages/autotorrent/bencode.py", line 62, in bdecode
    r, l = decode_func[six.indexbytes(x, 0)](x, 0)
IndexError: index out of range
ordinarygulp commented 6 years ago

This was an issue with corrupt .torrent files.

JohnDoee commented 6 years ago

We can turn this ticket into "better error on corrupt torrent"?

Errors like these can be confusing for a user yet easy for me to detect and inform about.