Opened 23 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:


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:


Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/ui/gtk3/", line 740, in on_button_file_clicked
  File "/usr/lib/python3/dist-packages/deluge/ui/gtk3/", line 256, in add_from_files
    if not self._add_torrent_liststore(
  File "/usr/lib/python3/dist-packages/deluge/ui/gtk3/", line 224, in _add_torrent_liststore
  File "/usr/lib/python3/dist-packages/deluge/ui/gtk3/", 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 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]
                    # 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.