fix adding torrents on windows

This commit is contained in:
Damien Churchill 2009-04-27 22:19:18 +00:00
parent 9ed37e070c
commit d4cfebadbc
2 changed files with 2 additions and 2 deletions

View File

@ -683,7 +683,7 @@ class AddTorrentDialog(component.Component):
for i, f in enumerate(torrent_filenames):
client.core.add_torrent_file(
os.path.split(f)[-1],
base64.encodestring(open(f).read()),
base64.encodestring(open(f, "rb").read()),
torrent_options[i])
if torrent_magnets:
client.core.add_torrent_magnets(torrent_magnets, torrent_magnet_options)

View File

@ -420,7 +420,7 @@ class WebApi(JSONComponent):
"""
for torrent in torrents:
filename = os.path.basename(torrent["path"])
fdump = base64.encodestring(open(torrent["path"], "r").read())
fdump = base64.encodestring(open(torrent["path"], "rb").read())
log.info("Adding torrent from file `%s` with options `%r`",
filename, torrent["options"])
client.core.add_torrent_file(filename, fdump, torrent["options"])