From a5ede35b4535eb7ab4e427cc43b1d077af5c7769 Mon Sep 17 00:00:00 2001 From: Soren Stoutner Date: Wed, 28 May 2025 17:00:15 -0700 Subject: [PATCH] Drop filter list entries that only have one, unsupported filter option. https://redmine.stoutner.com/issues/1217 --- src/helpers/FilterListHelper.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/helpers/FilterListHelper.cpp b/src/helpers/FilterListHelper.cpp index 59367cc..4b1dcbd 100644 --- a/src/helpers/FilterListHelper.cpp +++ b/src/helpers/FilterListHelper.cpp @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: GPL-3.0-or-later - * SPDX-FileCopyrightText: 2024 Soren Stoutner + * SPDX-FileCopyrightText: 2024-2025 Soren Stoutner * * This file is part of Privacy Browser PC . * @@ -1218,7 +1218,26 @@ FilterListStruct* FilterListHelper::populateFilterList(const QString &filterList } // Finish processing filter options. - if (filterListString.isEmpty() && !entryStructPointer->hasRequestOptions) // There are no applied entries and no request options. + + if ((entryStructPointer->originalFilterOptions == QLatin1String("1p")) || + (entryStructPointer->originalFilterOptions == QLatin1String("elemhide")) || + (entryStructPointer->originalFilterOptions == QLatin1String("genericblock")) || + (entryStructPointer->originalFilterOptions == QLatin1String("generichide")) || + (entryStructPointer->originalFilterOptions == QLatin1String("match-case")) || + (entryStructPointer->originalFilterOptions == QLatin1String("xhr"))) // There is a single filter option that Privacy Browser cannot process. + { + // Ignore entries that contain a single, unsupported filter option. See . + // `1p` is not an official filter option. + // `elemhide` isn't implemented by Privacy Browser. + // `genericblock` isn't implemented by Privacy Browser. + // `generichide` isn't implemented by Privacy Browser. + // `match-case` isn't currently implemented by Privacy Browser, but it could be if that became important. + // `xhr` is probably a misspelling of `xmlhttprequest`. + + // Log the dropping of the entry. + //qDebug().noquote().nospace() << "Unsupported filter option: " << entryStructPointer->originalEntry << " NOT added from " << filterListFileName << "."; + } + else if (filterListString.isEmpty() && !entryStructPointer->hasRequestOptions) // There are no applied entries and no request options. { // Ignore these entries as they will block all requests generally or for a specified domain. Typically these are left over after removing `csp=` filter options. -- 2.47.2