1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-03-09 20:01:08 +00:00

WebUI: Return error in case uploaded files are not torrents

This commit is contained in:
Gabriele 2014-11-08 15:00:00 +01:00
parent 8b8c9d3573
commit ee3a736787

View File

@ -260,7 +260,11 @@ void RequestHandler::action_command_upload()
if (!filePath.isEmpty())
{
QBtSession::instance()->addTorrent(filePath);
QTorrentHandle h = QBtSession::instance()->addTorrent(filePath);
if (!h.is_valid()) {
status(415, "Internal Server Error");
print(QObject::tr("Error: '%1' is not a valid torrent file.\n").arg(torrent.filename), CONTENT_TYPE_TXT);
}
// Clean up
fsutils::forceRemove(filePath);
}