From 9a7b0ee2c78f1807d34e754d1f051c88b55a2f0c Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Sun, 11 Oct 2015 21:12:37 +0100 Subject: Fixes for quotes in module names: Treat the module name from Nexus as HTML and convert into plain text. Allow ' in a module name Also removed the ::tr1:: namespace in the regexs --- src/downloadmanager.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/downloadmanager.cpp') diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index bc78cdc6..0cc45183 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -37,6 +37,7 @@ along with Mod Organizer. If not, see . #include #include #include +#include #include #include @@ -909,10 +910,10 @@ QString DownloadManager::getDownloadFileName(const QString &baseName) const QString DownloadManager::getFileNameFromNetworkReply(QNetworkReply *reply) { if (reply->hasRawHeader("Content-Disposition")) { - std::tr1::regex exp("filename=\"(.*)\""); + std::regex exp("filename=\"(.*)\""); - std::tr1::cmatch result; - if (std::tr1::regex_search(reply->rawHeader("Content-Disposition").constData(), result, exp)) { + std::cmatch result; + if (std::regex_search(reply->rawHeader("Content-Disposition").constData(), result, exp)) { return QString::fromUtf8(result.str(1).c_str()); } } @@ -1128,6 +1129,12 @@ void DownloadManager::nxmFilesAvailable(int, QVariant userData, QVariant resultD if (!info->m_FileInfo->version.isValid()) { info->m_FileInfo->version = info->m_FileInfo->newestVersion; } + //Nexus has HTMLd these so unhtml them if necessary + QTextDocument doc; + doc.setHtml(info->m_FileInfo->modName); + info->m_FileInfo->modName = doc.toPlainText(); + doc.setHtml(info->m_FileInfo->name); + info->m_FileInfo->name = doc.toPlainText(); info->m_FileInfo->fileCategory = convertFileCategory(fileInfo["category_id"].toInt()); info->m_FileInfo->fileTime = matchDate(fileInfo["date"].toString()); info->m_FileInfo->fileID = fileInfo["id"].toInt(); -- cgit v1.3.1