diff options
author | Andrew Resch <andrewresch@gmail.com> | 2009-05-12 20:22:21 +0000 |
---|---|---|
committer | Andrew Resch <andrewresch@gmail.com> | 2009-05-12 20:22:21 +0000 |
commit | 96687a996b589baac1607e476b5760338fb3c126 (patch) | |
tree | 5621ec35d673a4a116d946c3c5d99e7a5e979000 | |
parent | e47fb9911c2ead8b39c6635500b49e8993fb54eb (diff) | |
download | deluge-96687a996b589baac1607e476b5760338fb3c126.tar.gz deluge-96687a996b589baac1607e476b5760338fb3c126.tar.bz2 deluge-96687a996b589baac1607e476b5760338fb3c126.zip |
Fix #934 use 'name.utf-8' if available and decode the file path before
joining it with the prefix
-rw-r--r-- | deluge/ui/common.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/deluge/ui/common.py b/deluge/ui/common.py index ebd5d9460..fbc75f3d0 100644 --- a/deluge/ui/common.py +++ b/deluge/ui/common.py @@ -84,7 +84,12 @@ class TorrentInfo(object): elif "codepage" in self.__m_metadata: 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 self.__m_files = [] @@ -95,7 +100,7 @@ class TorrentInfo(object): for f in self.__m_metadata["info"]["files"]: 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"], 'download': True }) |