diff options
| author | Chris Bessent <lost.dragonist@gmail.com> | 2021-04-29 00:42:51 -0700 |
|---|---|---|
| committer | Chris Bessent <lost.dragonist@gmail.com> | 2021-04-29 00:50:11 -0700 |
| commit | 9638a797d16eb2d9b504a4a337a20b4eee535e4c (patch) | |
| tree | 51a41f8c54d57a41819ef431242d6d2509af065d /src/downloadmanager.cpp | |
| parent | 40a4bf1e3a25d98da481c6807e327f036a9a33e6 (diff) | |
Sanitize download file names
Also switch instance name sanitizer to MOBase version
Diffstat (limited to 'src/downloadmanager.cpp')
| -rw-r--r-- | src/downloadmanager.cpp | 5 |
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())); } } |
