diff --git a/src/core.py b/src/core.py index 01f65c24d..b2fee5175 100644 --- a/src/core.py +++ b/src/core.py @@ -645,9 +645,13 @@ class Manager: for torrent in self.state.torrents: if torrent not in torrents_with_unique_ID: # print "Adding torrent to core:", torrent.filename, torrent.save_dir, torrent.compact - unique_ID = deluge_core.add_torrent(torrent.filename, + try: + unique_ID = deluge_core.add_torrent(torrent.filename, torrent.save_dir, torrent.compact) + except InvalidEncodingError, e: + self.state.torrents.remove(torrent) + raise e # print "Got unique ID:", unique_ID # Now to check and see if there is enough free space for the download size = deluge_core.get_torrent_state(unique_ID)["total_size"] diff --git a/src/interface.py b/src/interface.py index 17908ed21..0f479b48e 100644 --- a/src/interface.py +++ b/src/interface.py @@ -777,13 +777,18 @@ class DelugeGTK: try: unique_id = self.manager.add_torrent(torrent, path, self.config.get('use_compact_storage', bool, default=False)) - except core.InsufficientFreeSpaceError, err: - nice_need = common.fsize(err.needed_space) - nice_free = common.fsize(err.free_space) + + if append: + self.torrent_model.append(self.get_list_from_unique_id(unique_id)) + except core.InvalidEncodingError, e: + print "InvalidEncodingError", e + dialogs.show_popup_warning(self.window, _("An error occured while trying to add the torrent. It's possible your .torrent file is corrupted.")) + except core.InsufficientFreeSpaceError, e: + nice_need = common.fsize(e.needed_space) + nice_free = common.fsize(e.free_space) - if append: - self.torrent_model.append(self.get_list_from_unique_id(unique_id)) +