Prevent wrongly encoded torrents from causing an xmlrpc exception thus causing
a blank torrent list
This commit is contained in:
parent
c4e4647f4b
commit
c429d56170
|
@ -445,7 +445,7 @@ class Torrent:
|
||||||
for index, file in enumerate(files):
|
for index, file in enumerate(files):
|
||||||
ret.append({
|
ret.append({
|
||||||
'index': index,
|
'index': index,
|
||||||
'path': file.path,
|
'path': file.path.decode("utf8", "ignore"),
|
||||||
'size': file.size,
|
'size': file.size,
|
||||||
'offset': file.offset
|
'offset': file.offset
|
||||||
})
|
})
|
||||||
|
@ -586,7 +586,11 @@ class Torrent:
|
||||||
|
|
||||||
def ti_name():
|
def ti_name():
|
||||||
if self.handle.has_metadata():
|
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
|
return self.torrent_id
|
||||||
def ti_priv():
|
def ti_priv():
|
||||||
if self.handle.has_metadata():
|
if self.handle.has_metadata():
|
||||||
|
|
Loading…
Reference in New Issue