Opened 22 months ago

#3531 new patch

Deluge cannot load some torrents created by qBittorrent

Reported by: Hello1024 Owned by:
Priority: minor Milestone: needs verified
Component: Unknown Version: 2.0.5
Keywords: Cc:

Description

qBittorrent adds padding between files so that every file starts on a block boundary.

If multiple files are the same size, then many of the padding files are also the same size. If two padding files are of the same size, they also have the same name. Deluge fails to add such files (the add torrent dialog shows the contents of the torrent, but upon clicking 'Add' an exception is raised).

Example file: https://github.com/yandex/YaLM-100B/blob/7e1fb5f436a499262fc14f6c83b2bb701e849b9f/yalm100b_checkpoint.torrent

Traceback:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/ui/gtk3/addtorrentdialog.py", line 740, in on_button_file_clicked
    self.add_from_files(result)
  File "/usr/lib/python3/dist-packages/deluge/ui/gtk3/addtorrentdialog.py", line 256, in add_from_files
    if not self._add_torrent_liststore(
  File "/usr/lib/python3/dist-packages/deluge/ui/gtk3/addtorrentdialog.py", line 224, in _add_torrent_liststore
    self.save_torrent_options(row_iter)
  File "/usr/lib/python3/dist-packages/deluge/ui/gtk3/addtorrentdialog.py", line 579, in save_torrent_options
    file_dict['download'] = files_priorities[i]
KeyError: 13

I think in this case the fix is easy...

Modify the code in addtorrentdialog.py around line 579 to say:

        if len(files_priorities) > 0:
            for i, file_dict in enumerate(self.files[torrent_id]):
                if i in files_priorities:
                    file_dict['download'] = files_priorities[i]
                else:
                    # Happens in the case of duplicate filenames.
                    file_dict['download'] = False

I have tested this, and it loads the torrent and things seem to work.

Change History (0)

Note: See TracTickets for help on using tickets.