Browse Source

WebUI: Return error in case uploaded files are not torrents

adaptive-webui-19844
Gabriele 10 years ago
parent
commit
ee3a736787
  1. 6
      src/webui/requesthandler.cpp

6
src/webui/requesthandler.cpp

@ -260,7 +260,11 @@ void RequestHandler::action_command_upload()
if (!filePath.isEmpty()) 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 // Clean up
fsutils::forceRemove(filePath); fsutils::forceRemove(filePath);
} }

Loading…
Cancel
Save