mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-22 08:27:24 -06:00
Let's check if the torrent file can actually be opened before passing it to libtorrent
If we don't have enough permissions, libtorrent will spew a pretty useless, irrelevant and almost wrong message: "Failed to load the torrent: torrent file is not a dictionary"
This commit is contained in:
committed by
sledgehammer999
parent
51b93b4284
commit
09bc14cc57
@@ -177,6 +177,12 @@ bool AddNewTorrentDialog::loadTorrent(const QString& torrent_path)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QFileInfo fileinfo(m_filePath);
|
||||||
|
if (!fileinfo.isReadable()) {
|
||||||
|
MessageBoxRaised::critical(0, tr("I/O Error"), tr("The torrent file cannot be read from the disk. Probably you don't have enough permissions."));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
m_hasMetadata = true;
|
m_hasMetadata = true;
|
||||||
QString error;
|
QString error;
|
||||||
m_torrentInfo = BitTorrent::TorrentInfo::loadFromFile(m_filePath, error);
|
m_torrentInfo = BitTorrent::TorrentInfo::loadFromFile(m_filePath, error);
|
||||||
|
|||||||
Reference in New Issue
Block a user