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/createinstancedialogpages.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/createinstancedialogpages.cpp') diff --git a/src/createinstancedialogpages.cpp b/src/createinstancedialogpages.cpp index c337ba86..09026fa4 100644 --- a/src/createinstancedialogpages.cpp +++ b/src/createinstancedialogpages.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "filesystemutilities.h" namespace cid { @@ -856,7 +857,7 @@ QString NamePage::selectedInstanceName() const } const auto text = ui->instanceName->text().trimmed(); - return InstanceManager::singleton().sanitizeInstanceName(text); + return MOBase::sanitizeFileName(text); } void NamePage::onChanged() @@ -883,7 +884,7 @@ bool NamePage::checkName(QString parentDir, QString name) if (name.isEmpty()) { empty = true; } else { - if (InstanceManager::singleton().validInstanceName(name)) { + if (MOBase::validFileName(name)) { exists = QDir(parentDir).exists(name); } else { invalid = true; @@ -1108,7 +1109,7 @@ bool PathsPage::checkPath( } else { const QDir d(path); - if (m.validInstanceName(d.dirName())) { + if (MOBase::validFileName(d.dirName())) { if (m_dlg.rawCreationInfo().type == CreateInstanceDialog::Portable) { // the default data path for a portable instance is the application // directory, so it's not an error if it exists -- cgit v1.3.1