Browse Source

Merge pull request #11201 from Chocobo1/watcher

Treat .magnet file extension as case insensitive in filesystem watcher
adaptive-webui-19844
Mike Tzou 5 years ago committed by GitHub
parent
commit
ee8b99ffd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/base/filesystemwatcher.cpp
  2. 2
      src/base/scanfoldersmodel.cpp

2
src/base/filesystemwatcher.cpp

@ -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;

2
src/base/scanfoldersmodel.cpp

@ -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);

Loading…
Cancel
Save