mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-17 13:56:47 +00:00
fix handling of invalid torrents
This commit is contained in:
parent
ea7fdc3bc1
commit
c21f650c45
@ -358,7 +358,12 @@ class Manager:
|
|||||||
|
|
||||||
# Dump torrent info without adding
|
# Dump torrent info without adding
|
||||||
def dump_torrent_file_info(self, torrent):
|
def dump_torrent_file_info(self, torrent):
|
||||||
return deluge_core.dump_file_info(torrent)
|
try:
|
||||||
|
ret = deluge_core.dump_file_info(torrent)
|
||||||
|
except SystemError:
|
||||||
|
print "invalid file"
|
||||||
|
else:
|
||||||
|
return ret
|
||||||
|
|
||||||
# Dump trackers from torrent file
|
# Dump trackers from torrent file
|
||||||
def dump_trackers(self, torrent):
|
def dump_trackers(self, torrent):
|
||||||
|
@ -212,8 +212,7 @@ torrent_info internal_get_torrent_info(std::string const& torrent_name)
|
|||||||
{
|
{
|
||||||
std::ifstream in(torrent_name.c_str(), std::ios_base::binary);
|
std::ifstream in(torrent_name.c_str(), std::ios_base::binary);
|
||||||
in.unsetf(std::ios_base::skipws);
|
in.unsetf(std::ios_base::skipws);
|
||||||
entry e;
|
entry e = bdecode(std::istream_iterator<char>(in), std::istream_iterator<char>());
|
||||||
e = bdecode(std::istream_iterator<char>(in), std::istream_iterator<char>());
|
|
||||||
|
|
||||||
torrent_info t(e);
|
torrent_info t(e);
|
||||||
|
|
||||||
@ -691,6 +690,7 @@ static PyObject *torrent_dump_file_info(PyObject *self, PyObject *args)
|
|||||||
if (!PyArg_ParseTuple(args, "s", &name))
|
if (!PyArg_ParseTuple(args, "s", &name))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
try{
|
||||||
torrent_info t = internal_get_torrent_info(name);
|
torrent_info t = internal_get_torrent_info(name);
|
||||||
|
|
||||||
PyObject *file_info;
|
PyObject *file_info;
|
||||||
@ -712,6 +712,10 @@ static PyObject *torrent_dump_file_info(PyObject *self, PyObject *args)
|
|||||||
};
|
};
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
}
|
||||||
|
catch(invalid_encoding&){
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *torrent_dump_trackers(PyObject *self, PyObject *args)
|
static PyObject *torrent_dump_trackers(PyObject *self, PyObject *args)
|
||||||
|
@ -1454,6 +1454,8 @@ torrent error."))
|
|||||||
dialogs.show_popup_warning(self.window, _("There is not enough free\
|
dialogs.show_popup_warning(self.window, _("There is not enough free\
|
||||||
disk space to complete your download.") + "\n" + _("Space Needed:") + " " + \
|
disk space to complete your download.") + "\n" + _("Space Needed:") + " " + \
|
||||||
nice_need + "\n" + _("Available Space:") + " " + nice_free)
|
nice_need + "\n" + _("Available Space:") + " " + nice_free)
|
||||||
|
except core.InvalidEncodingError, e:
|
||||||
|
print "invalid encoding\n"
|
||||||
else:
|
else:
|
||||||
self.torrent_model_append(unique_id)
|
self.torrent_model_append(unique_id)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user