mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Add "parent directory match" priority between exact and host match
This commit is contained in:
parent
34ed63f495
commit
9aec84dee7
@ -948,6 +948,11 @@ int BrowserService::sortPriority(const QStringList& urls, const QString& siteUrl
|
|||||||
return 90;
|
return 90;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Parent directory match
|
||||||
|
if (url.isParentOf(siteUrl) || url.isParentOf(formUrl)) {
|
||||||
|
return 85;
|
||||||
|
}
|
||||||
|
|
||||||
// Match without path (ie, FQDN match), form url prioritizes lower than site url
|
// Match without path (ie, FQDN match), form url prioritizes lower than site url
|
||||||
if (url.host() == siteUrl.host()) {
|
if (url.host() == siteUrl.host()) {
|
||||||
return 80;
|
return 80;
|
||||||
|
@ -165,10 +165,13 @@ void TestBrowser::testSortPriority_data()
|
|||||||
|
|
||||||
QTest::newRow("Site Query Mismatch") << siteUrl << siteUrl + "?test=test" << formUrl << 90;
|
QTest::newRow("Site Query Mismatch") << siteUrl << siteUrl + "?test=test" << formUrl << 90;
|
||||||
|
|
||||||
QTest::newRow("Path Mismatch (site)") << "https://github.com/" << siteUrl << formUrl << 80;
|
QTest::newRow("Path Mismatch (site)") << "https://github.com/" << siteUrl << formUrl << 85;
|
||||||
QTest::newRow("Path Mismatch (site) No Scheme") << "github.com" << siteUrl << formUrl << 80;
|
QTest::newRow("Path Mismatch (site) No Scheme") << "github.com" << siteUrl << formUrl << 85;
|
||||||
QTest::newRow("Path Mismatch (form)") << "https://github.com/"
|
QTest::newRow("Path Mismatch (form)") << "https://github.com/"
|
||||||
<< "https://github.net" << formUrl << 70;
|
<< "https://github.net" << formUrl << 85;
|
||||||
|
QTest::newRow("Path Mismatch (diff parent)") << "https://github.com/keepassxreboot" << siteUrl << formUrl << 80;
|
||||||
|
QTest::newRow("Path Mismatch (diff parent, form)") << "https://github.com/keepassxreboot"
|
||||||
|
<< "https://github.net" << formUrl << 70;
|
||||||
|
|
||||||
QTest::newRow("Subdomain Mismatch (site)") << siteUrl << "https://sub.github.com/"
|
QTest::newRow("Subdomain Mismatch (site)") << siteUrl << "https://sub.github.com/"
|
||||||
<< "https://github.net/" << 60;
|
<< "https://github.net/" << 60;
|
||||||
|
Loading…
Reference in New Issue
Block a user