summaryrefslogtreecommitdiff
path: root/src/downloadmanager.cpp
diff options
context:
space:
mode:
authorChris Bessent <lost.dragonist@gmail.com>2021-05-01 14:38:17 -0700
committerGitHub <noreply@github.com>2021-05-01 14:38:17 -0700
commitf098491306f8aea2660bfde5f20dbba97c326301 (patch)
treee4f4fa4ea304198579a5f549aaeb7878bf781676 /src/downloadmanager.cpp
parentbcaceb96373cdd0a8ef420850e5c5719e3c6c809 (diff)
parentdc3dcd9500fb7521b01f6707c443e09e8cc69d1c (diff)
Merge pull request #1503 from LostDragonist/filename
Sanitize download file names
Diffstat (limited to 'src/downloadmanager.cpp')
-rw-r--r--src/downloadmanager.cpp5
1 files changed, 3 insertions, 2 deletions
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 <http://www.gnu.org/licenses/>.
#include "shared/util.h"
#include <utility.h>
#include <report.h>
+#include "filesystemutilities.h"
#include <QTimer>
#include <QFileInfo>
@@ -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()));
}
}