mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-02 22:48:40 +00:00
Fix #934 use 'name.utf-8' if available and decode the file path before
joining it with the prefix
This commit is contained in:
parent
e47fb9911c
commit
96687a996b
1 changed files with 7 additions and 2 deletions
|
@ -84,7 +84,12 @@ class TorrentInfo(object):
|
||||||
elif "codepage" in self.__m_metadata:
|
elif "codepage" in self.__m_metadata:
|
||||||
self.encoding = str(self.__m_metadata["codepage"])
|
self.encoding = str(self.__m_metadata["codepage"])
|
||||||
|
|
||||||
self.__m_name = decode_string(self.__m_metadata["info"]["name"])
|
# Check if 'name.utf-8' is in the torrent and if not try to decode the string
|
||||||
|
# using the encoding found.
|
||||||
|
if "name.utf-8" in self.__m_metadata["info"]:
|
||||||
|
self.__m_name = decode_string(self.__m_metadata["info"]["name.utf-8"])
|
||||||
|
else:
|
||||||
|
self.__m_name = decode_string(self.__m_metadata["info"]["name"], self.encoding)
|
||||||
|
|
||||||
# Get list of files from torrent info
|
# Get list of files from torrent info
|
||||||
self.__m_files = []
|
self.__m_files = []
|
||||||
|
@ -95,7 +100,7 @@ class TorrentInfo(object):
|
||||||
|
|
||||||
for f in self.__m_metadata["info"]["files"]:
|
for f in self.__m_metadata["info"]["files"]:
|
||||||
self.__m_files.append({
|
self.__m_files.append({
|
||||||
'path': decode_string(os.path.join(prefix, *f["path"])),
|
'path': decode_string(os.path.join(prefix, decode_string(os.path.join(*f["path"]))))
|
||||||
'size': f["length"],
|
'size': f["length"],
|
||||||
'download': True
|
'download': True
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue