mirror of
https://github.com/tnodir/fort
synced 2024-11-15 10:45:10 +00:00
Conf: Fix parsing app paths with spaces.
This commit is contained in:
parent
3e23cc8342
commit
2b19aef2f5
@ -36,7 +36,7 @@ void Test::confWriteRead()
|
|||||||
"System"
|
"System"
|
||||||
);
|
);
|
||||||
appGroup1->setAllowText(
|
appGroup1->setAllowText(
|
||||||
"C:\\Programs\\Skype\\Phone\\Skype.exe\n"
|
"C:\\Program Files\\Skype\\Phone\\Skype.exe\n"
|
||||||
"C:\\Utils\\Dev\\Git\\\n"
|
"C:\\Utils\\Dev\\Git\\\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -68,7 +68,8 @@ void Test::confWriteRead()
|
|||||||
QVERIFY(!FortCommon::confIpInRange(data, NetUtil::textToIp4("193.0.0.0")));
|
QVERIFY(!FortCommon::confIpInRange(data, NetUtil::textToIp4("193.0.0.0")));
|
||||||
|
|
||||||
QVERIFY(FortCommon::confAppBlocked(data, "System"));
|
QVERIFY(FortCommon::confAppBlocked(data, "System"));
|
||||||
QVERIFY(!FortCommon::confAppBlocked(data, FileUtil::pathToKernelPath("C:\\Programs\\Skype\\Phone\\Skype.exe").toLower()));
|
QVERIFY(!FortCommon::confAppBlocked(data, FileUtil::pathToKernelPath("C:\\Program Files\\Skype\\Phone\\Skype.exe").toLower()));
|
||||||
QVERIFY(!FortCommon::confAppBlocked(data, FileUtil::pathToKernelPath("C:\\Utils\\Dev\\Git\\").toLower()));
|
QVERIFY(!FortCommon::confAppBlocked(data, FileUtil::pathToKernelPath("C:\\Utils\\Dev\\Git\\").toLower()));
|
||||||
|
QVERIFY(FortCommon::confAppBlocked(data, FileUtil::pathToKernelPath("C:\\Program Files\\Test.exe").toLower()));
|
||||||
QVERIFY(FortCommon::confAppBlocked(data, FileUtil::pathToKernelPath("C:\\Utils\\Firefox\\Bin\\firefox.exe").toLower()));
|
QVERIFY(FortCommon::confAppBlocked(data, FileUtil::pathToKernelPath("C:\\Utils\\Firefox\\Bin\\firefox.exe").toLower()));
|
||||||
}
|
}
|
||||||
|
@ -181,13 +181,13 @@ bool ConfUtil::parseApps(const QString &text, bool blocked,
|
|||||||
|
|
||||||
QString ConfUtil::parseAppPath(const QStringRef &line)
|
QString ConfUtil::parseAppPath(const QStringRef &line)
|
||||||
{
|
{
|
||||||
const QRegularExpression re("\\s*\"?\\s*(\\S+)\\s*\"?\\s*");
|
const QRegularExpression re("\\s*\"?\\s*([^\"]+)\\s*\"?\\s*");
|
||||||
const QRegularExpressionMatch match = re.match(line);
|
const QRegularExpressionMatch match = re.match(line);
|
||||||
|
|
||||||
if (!match.hasMatch())
|
if (!match.hasMatch())
|
||||||
return QString();
|
return QString();
|
||||||
|
|
||||||
const QStringRef path = match.capturedRef(1);
|
const QStringRef path = match.capturedRef(1).trimmed();
|
||||||
|
|
||||||
const QString systemPath("System");
|
const QString systemPath("System");
|
||||||
if (!QStringRef::compare(path, systemPath, Qt::CaseInsensitive))
|
if (!QStringRef::compare(path, systemPath, Qt::CaseInsensitive))
|
||||||
|
Loading…
Reference in New Issue
Block a user