From c429d561708f990b77af0f68fa1dfb4c88878690 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Mon, 17 Nov 2008 08:28:32 +0000 Subject: [PATCH] Prevent wrongly encoded torrents from causing an xmlrpc exception thus causing a blank torrent list --- deluge/core/torrent.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py index e6fdf3673..4a263f174 100644 --- a/deluge/core/torrent.py +++ b/deluge/core/torrent.py @@ -445,7 +445,7 @@ class Torrent: for index, file in enumerate(files): ret.append({ 'index': index, - 'path': file.path, + 'path': file.path.decode("utf8", "ignore"), 'size': file.size, 'offset': file.offset }) @@ -586,7 +586,11 @@ class Torrent: def ti_name(): if self.handle.has_metadata(): - return self.torrent_info.name() + try: + return self.torrent_info.name().decode("utf8", "ignore") + except UnicodeDecodeError: + return self.torrent_info.name() + return self.torrent_id def ti_priv(): if self.handle.has_metadata():