From d2e76058cd6542cc5d69589cb0f2b4de48d404b6 Mon Sep 17 00:00:00 2001 From: varjolintu Date: Mon, 13 Jan 2020 11:26:45 +0200 Subject: [PATCH] Fix base domain matching --- src/browser/BrowserService.cpp | 2 +- tests/TestBrowser.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/browser/BrowserService.cpp b/src/browser/BrowserService.cpp index 8c451bf1e..f7ae2858a 100644 --- a/src/browser/BrowserService.cpp +++ b/src/browser/BrowserService.cpp @@ -1053,7 +1053,7 @@ bool BrowserService::handleURL(const QString& entryUrl, const QString& url, cons } // Filter to match hostname in URL field - if (siteQUrl.host().endsWith(entryQUrl.host())) { + if (siteQUrl.host().endsWith(entryQUrl.host()) && baseDomain(siteQUrl.host()) == baseDomain(entryQUrl.host())) { return true; } diff --git a/tests/TestBrowser.cpp b/tests/TestBrowser.cpp index 8da2a2896..5ddb5e898 100644 --- a/tests/TestBrowser.cpp +++ b/tests/TestBrowser.cpp @@ -298,7 +298,8 @@ void TestBrowser::testSubdomainsAndPaths() "http://login.github.com/pathtonowhere", ".github.com", // Invalid URL "www.github.com/", - "https://github" // Invalid URL + "https://github", // Invalid URL + "https://hub.com" // Should not return }; createEntries(urls, root);