From edbe30e82bbd8e64c60fd2c2197eb04879e541c2 Mon Sep 17 00:00:00 2001 From: KoenigMjr <135820716+KoenigMjr@users.noreply.github.com> Date: Wed, 1 Jul 2026 12:34:03 +0200 Subject: [PATCH] [bugfix/descriptor] allow empty string replacements in descriptor module The descriptor module previously used a truthy check (`if description:`) to determine whether a matching description was found. In Python, an empty string (`""`) evaluates to False, causing the module to incorrectly fall back to the default `scan_value` when an empty replacement string was explicitly defined (e.g., in a fallback regex catch-all `.*,,true`). Switched the conditional check to `if description is not None:` to properly differentiate between a missing match (`None`) and an intentional empty replacement string (`""`). This ensures catch-all fallback entries in CSVs can clear fields as intended. --- module/descriptor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/descriptor.py b/module/descriptor.py index eeda938c..296af9d2 100644 --- a/module/descriptor.py +++ b/module/descriptor.py @@ -10,7 +10,7 @@ by Bastian Schroll @file: descriptor.py -@date: 03.12.2025 +@date: 01.07.2026 @author: Bastian Schroll @description: Module to add descriptions to bwPackets with CSV and Regex support """ @@ -207,7 +207,7 @@ def doWork(self, bwPacket): # Search for matching description in unified cache description = self._find_description(descriptor_key, scan_value, bwPacket) - if description: + if description is not None: bwPacket.set(descr_field, description) logging.info("Description set: '%s' -> '%s'", scan_value, description) else: