From 9638a797d16eb2d9b504a4a337a20b4eee535e4c Mon Sep 17 00:00:00 2001 From: Chris Bessent Date: Thu, 29 Apr 2021 00:42:51 -0700 Subject: Sanitize download file names Also switch instance name sanitizer to MOBase version --- src/downloadmanager.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/downloadmanager.cpp') diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index 676b43de..4c8e820f 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -33,6 +33,7 @@ along with Mod Organizer. If not, see . #include "shared/util.h" #include #include +#include "filesystemutilities.h" #include #include @@ -1456,7 +1457,7 @@ void DownloadManager::markUninstalled(QString fileName) QString DownloadManager::getDownloadFileName(const QString &baseName, bool rename) const { - QString fullPath = m_OutputDirectory + "/" + baseName; + QString fullPath = m_OutputDirectory + "/" + MOBase::sanitizeFileName(baseName); if (QFile::exists(fullPath) && rename) { int i = 1; while (QFile::exists(QString("%1/%2_%3").arg(m_OutputDirectory).arg(i).arg(baseName))) { @@ -1476,7 +1477,7 @@ QString DownloadManager::getFileNameFromNetworkReply(QNetworkReply *reply) std::cmatch result; if (std::regex_search(reply->rawHeader("Content-Disposition").constData(), result, exp)) { - return QString::fromUtf8(result.str(1).c_str()); + return MOBase::sanitizeFileName(QString::fromUtf8(result.str(1).c_str())); } } -- cgit v1.3.1