mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 21:33:27 -07:00
WebUI: Return error in case uploaded files are not torrents
This commit is contained in:
parent
8b8c9d3573
commit
ee3a736787
1 changed files with 5 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue