Browse Source

Improve path validness test

adaptive-webui-19844
Chocobo1 2 years ago
parent
commit
43df7d0cd4
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 6
      src/base/path.cpp

6
src/base/path.cpp

@ -76,12 +76,14 @@ bool Path::isValid() const
if (isEmpty()) if (isEmpty())
return false; return false;
// https://stackoverflow.com/a/31976060
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
const QRegularExpression regex {u"[:?\"*<>|]"_qs}; // \\37 is using base-8 number system
const QRegularExpression regex {u"[\\0-\\37:?\"*<>|]"_qs};
#elif defined(Q_OS_MACOS) #elif defined(Q_OS_MACOS)
const QRegularExpression regex {u"[\\0:]"_qs}; const QRegularExpression regex {u"[\\0:]"_qs};
#else #else
const QRegularExpression regex {u"[\\0]"_qs}; const QRegularExpression regex {u"\\0"_qs};
#endif #endif
return !m_pathStr.contains(regex); return !m_pathStr.contains(regex);
} }

Loading…
Cancel
Save