From e5cecd05dfc7c3753a029212aa7f70a857cead1a Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Tue, 3 Dec 2024 16:36:16 +0800 Subject: [PATCH] Don't follow symlink when creating torrents Now on Windows, it won't follow/include .lnk files when creating torrents. Note that libtorrent will throw errors if we force adding .lnk files. Closes #13286. --- src/base/bittorrent/torrentcreator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/base/bittorrent/torrentcreator.cpp b/src/base/bittorrent/torrentcreator.cpp index 3cd26ba7c03a..c554e36b33ae 100644 --- a/src/base/bittorrent/torrentcreator.cpp +++ b/src/base/bittorrent/torrentcreator.cpp @@ -123,7 +123,7 @@ void TorrentCreator::run() // need to sort the file names by natural sort order QStringList dirs = {m_params.sourcePath.data()}; - QDirIterator dirIter {m_params.sourcePath.data(), (QDir::AllDirs | QDir::NoDotAndDotDot), QDirIterator::Subdirectories}; + QDirIterator dirIter {m_params.sourcePath.data(), (QDir::AllDirs | QDir::NoDotAndDotDot | QDir::NoSymLinks), QDirIterator::Subdirectories}; while (dirIter.hasNext()) { const QString filePath = dirIter.next(); @@ -138,7 +138,7 @@ void TorrentCreator::run() { QStringList tmpNames; // natural sort files within each dir - QDirIterator fileIter {dir, QDir::Files}; + QDirIterator fileIter {dir, (QDir::Files | QDir::NoSymLinks)}; while (fileIter.hasNext()) { const QFileInfo fileInfo = fileIter.nextFileInfo();