Treat .magnet file extension as case insensitive

Closes #11200.
This commit is contained in:
Chocobo1 2019-09-06 12:30:50 +08:00
parent ee0f38a696
commit 7113174593
No known key found for this signature in database
GPG key ID: 210D9C873253A68C
2 changed files with 2 additions and 2 deletions

View file

@ -160,7 +160,7 @@ void FileSystemWatcher::processTorrentsInDir(const QDir &dir)
const QStringList files = dir.entryList({"*.torrent", "*.magnet"}, QDir::Files); const QStringList files = dir.entryList({"*.torrent", "*.magnet"}, QDir::Files);
for (const QString &file : files) { for (const QString &file : files) {
const QString fileAbsPath = dir.absoluteFilePath(file); const QString fileAbsPath = dir.absoluteFilePath(file);
if (file.endsWith(".magnet")) if (file.endsWith(".magnet", Qt::CaseInsensitive))
torrents << fileAbsPath; torrents << fileAbsPath;
else if (BitTorrent::TorrentInfo::loadFromFile(fileAbsPath).isValid()) else if (BitTorrent::TorrentInfo::loadFromFile(fileAbsPath).isValid())
torrents << fileAbsPath; torrents << fileAbsPath;

View file

@ -360,7 +360,7 @@ void ScanFoldersModel::addTorrentsToSession(const QStringList &pathList)
else if (!downloadInDefaultFolder(file)) else if (!downloadInDefaultFolder(file))
params.savePath = downloadPathTorrentFolder(file); params.savePath = downloadPathTorrentFolder(file);
if (file.endsWith(".magnet")) { if (file.endsWith(".magnet", Qt::CaseInsensitive)) {
QFile f(file); QFile f(file);
if (f.open(QIODevice::ReadOnly | QIODevice::Text)) { if (f.open(QIODevice::ReadOnly | QIODevice::Text)) {
QTextStream str(&f); QTextStream str(&f);