Adjust search filter URL matching

Need to check for exact match on base URL to account for Bing, which strips the path
pull/227/head
Kevin Payravi 2023-08-31 23:05:03 -06:00
parent e0a0656e10
commit fb86cc1f18
1 changed files with 4 additions and 1 deletions

View File

@ -142,8 +142,11 @@ function filterSearchResults(searchResults, searchEngine, storage) {
let matchingSites = sites.filter(el => {
let link = String(decodeURIComponent(searchResultLink));
if (link.substring(8).includes('/')) {
return link.includes('https://' + el.origin_base_url + el.origin_content_path);
// If the URL has a path, check if an exact match with base URL or base URL + content path
// This is done to ensure we capture non-English Fandom wikis correctly
return (link === 'https://' + el.origin_base_url) || (link.includes('https://' + el.origin_base_url + el.origin_content_path));
} else {
// If URL does not have a path, just check base URL
return link.includes('https://' + el.origin_base_url);
}
});