From ee3a736787223e5e978c028e7e4d762513bd3430 Mon Sep 17 00:00:00 2001 From: Gabriele Date: Sat, 8 Nov 2014 15:00:00 +0100 Subject: [PATCH] WebUI: Return error in case uploaded files are not torrents --- src/webui/requesthandler.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/webui/requesthandler.cpp b/src/webui/requesthandler.cpp index dea1a42ba..da049c625 100644 --- a/src/webui/requesthandler.cpp +++ b/src/webui/requesthandler.cpp @@ -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); }