Fix loose URL comparison

This commit is contained in:
varjolintu 2025-06-15 15:00:12 +03:00 committed by Jonathan White
parent eac95df000
commit 3c7c3b0a5f
2 changed files with 3 additions and 2 deletions

View file

@ -171,8 +171,8 @@ bool UrlTools::isUrlValid(const QString& urlField, bool looseComparison) const
url.remove(0, 1);
url.remove(url.length() - 1, 1);
} else {
// Do not allow URL with just wildcards, or double wildcards, or no separator (.)
if (url.length() == url.count("*") || url.contains("**") || url.contains("*.*") || !url.contains(".")) {
// Do not allow URL with just wildcards, or double wildcards
if (url.length() == url.count("*") || url.contains("**") || url.contains("*.*")) {
return false;
}

View file

@ -160,6 +160,7 @@ void TestUrlTools::testIsUrlValidWithLooseComparison()
urls["https://example.*"] = false;
urls["https://*.example.*"] = false;
urls["https://example.c*"] = false;
urls["https://myowndomain:8000"] = true;
QHashIterator<QString, bool> i(urls);
while (i.hasNext()) {