From e9d289f2a41b65efc3cfe1d6187fb19c4ea271d5 Mon Sep 17 00:00:00 2001 From: Lili Kurek Date: Tue, 1 Jul 2025 11:29:49 +0000 Subject: [PATCH 1/2] Manager: Allow whitespace and some special characters in machine creation wizard I'm not sure why whitespace was disallowed in the first place as Windows accepts them everywhere, including at the start of the name. The character blacklist was Windows-centric, but macOS accepts everything besides slash and colon and Linux disallows only a slash. --- src/qt/qt_vmmanager_addmachine.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/qt/qt_vmmanager_addmachine.cpp b/src/qt/qt_vmmanager_addmachine.cpp index db40972a1..3005c0346 100644 --- a/src/qt/qt_vmmanager_addmachine.cpp +++ b/src/qt/qt_vmmanager_addmachine.cpp @@ -210,7 +210,13 @@ NameAndLocationPage(QWidget *parent) { setTitle(tr("System name and location")); - dirValidate = QRegularExpression(R"(^[^\\/:*?"<>|\s]+$)"); +#if defined(_WIN32) + dirValidate = QRegularExpression(R"(^[^\\/:*?"<>|]+$)"); +#elif defined(__APPLE__) + dirValidate = QRegularExpression(R"(^[^/:]+$)"); +#else + dirValidate = QRegularExpression(R"(^[^/]+$)"); +#endif const auto topLabel = new QLabel(tr("Enter the name of the system and choose the location")); topLabel->setWordWrap(true); @@ -282,7 +288,7 @@ NameAndLocationPage::isComplete() const if (systemName->text().isEmpty()) { systemNameValidation->setText(tr("Please enter a system name")); } else if (!systemName->text().contains(dirValidate)) { - systemNameValidation->setText(tr("System name cannot contain a space or certain characters")); + systemNameValidation->setText(tr("System name cannot certain characters")); } else if (const QDir newDir = QDir::cleanPath(systemLocation->text() + "/" + systemName->text()); newDir.exists()) { systemNameValidation->setText(tr("System name already exists")); } else { From bef3b9e155d26b539002e1a88edd5adfc0b6c8c7 Mon Sep 17 00:00:00 2001 From: Lili Kurek Date: Tue, 1 Jul 2025 11:33:18 +0000 Subject: [PATCH 2/2] Cut too much of a string --- src/qt/qt_vmmanager_addmachine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/qt_vmmanager_addmachine.cpp b/src/qt/qt_vmmanager_addmachine.cpp index 3005c0346..597c2ef11 100644 --- a/src/qt/qt_vmmanager_addmachine.cpp +++ b/src/qt/qt_vmmanager_addmachine.cpp @@ -288,7 +288,7 @@ NameAndLocationPage::isComplete() const if (systemName->text().isEmpty()) { systemNameValidation->setText(tr("Please enter a system name")); } else if (!systemName->text().contains(dirValidate)) { - systemNameValidation->setText(tr("System name cannot certain characters")); + systemNameValidation->setText(tr("System name cannot contain certain characters")); } else if (const QDir newDir = QDir::cleanPath(systemLocation->text() + "/" + systemName->text()); newDir.exists()) { systemNameValidation->setText(tr("System name already exists")); } else {