Wintermute0110 / torrentverify

List torrent file contents and checks downloaded data
38 stars 5 forks source link

Error while checking a single file torrent #6

Open funkypoly opened 4 years ago

funkypoly commented 4 years ago

Hello,

It's a bit funny, but while i was checking some small torrents which have only a single file , i noticed that torrentverify is giving errors .

TorrentVerify version 0.1.0 Bdecoding torrent file a156ewa310.torrent... done Traceback (most recent call last): File "./torrentverify.py", line 987, in torrent_obj.dir_data = os.path.join(data_directory, torrent_obj.dir_name) File "/usr/lib/python3.7/posixpath.py", line 94, in join genericpath._check_arg_types('join', a, *p) File "/usr/lib/python3.7/genericpath.py", line 149, in _check_arg_types (funcname, s.class.name)) from None TypeError: join() argument must be str or bytes, not 'NoneType'

I don't know what this mean , but i thought it would be useful to mention it.

Any torrent with two or more files doesn't give this error.

Thanks !

Wintermute0110 commented 4 years ago

I guess the problem is that torrent_obj.dir_name is None. I have tested torrentverify with single-file torrents and worked fine, however this particular torrent is causing problems. Can you share your torrent file so I can reproduce the bug and fix it?

By the way, single-file torrents and multiple-file torrents are handled separately because the way the torrent file is made is different. There could be bugs that affect only to single-torrent files or multiple-torrent files.

funkypoly commented 4 years ago

You are right! There is no directory ! I was trying to understand the reason some torrents produce this error, but i didn't notice the directory structure.

Can this be fixed? Do you want me to send you a torrent without folder ?

Wintermute0110 commented 4 years ago

@funkypoly I will try to make a quick patch so you can test. I will let you know when finished.

Tailslide commented 1 year ago

This change fixes it at line 987:

   if torrent_obj.dir_name != None:
      torrent_obj.dir_data = os.path.join(data_directory, torrent_obj.dir_name)
    else:
      torrent_obj.dir_data = data_directory