]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/commitdiff
Drop filter list entries that only have one, unsupported filter option. https:/...
authorSoren Stoutner <soren@stoutner.com>
Thu, 29 May 2025 00:00:15 +0000 (17:00 -0700)
committerSoren Stoutner <soren@stoutner.com>
Thu, 29 May 2025 00:00:15 +0000 (17:00 -0700)
src/helpers/FilterListHelper.cpp

index 59367cc21be676e60493827b043e61c9a66f431e..4b1dcbdb1c53ce287a7d7c3d83fcb3738226b599 100644 (file)
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: GPL-3.0-or-later
- * SPDX-FileCopyrightText: 2024 Soren Stoutner <soren@stoutner.com>
+ * SPDX-FileCopyrightText: 2024-2025 Soren Stoutner <soren@stoutner.com>
  *
  * This file is part of Privacy Browser PC <https://www.stoutner.com/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 <https://redmine.stoutner.com/issues/1217>.
+                // `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.