From 413779ee2a9b7e8f50ecf4241e0ed848324ca8ba Mon Sep 17 00:00:00 2001 From: ryzendigo <48058157+ryzendigo@users.noreply.github.com> Date: Mon, 16 Mar 2026 14:40:40 +0800 Subject: [PATCH 1/3] fix: operator precedence bug in detection type check The condition: topic == DetectionTypeEnum.api.value or DetectionTypeEnum.lpr.value evaluates as: (topic == DetectionTypeEnum.api.value) or (DetectionTypeEnum.lpr.value) Since DetectionTypeEnum.lpr.value is a non-empty string (truthy), the second operand is always True regardless of topic. The intended check is whether topic matches either enum value: topic == DetectionTypeEnum.api.value or topic == DetectionTypeEnum.lpr.value --- frigate/record/maintainer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frigate/record/maintainer.py b/frigate/record/maintainer.py index 68040476a..26b64b2d3 100644 --- a/frigate/record/maintainer.py +++ b/frigate/record/maintainer.py @@ -727,7 +727,7 @@ class RecordingMaintainer(threading.Thread): ) ) elif ( - topic == DetectionTypeEnum.api.value or DetectionTypeEnum.lpr.value + topic == DetectionTypeEnum.api.value or topic == DetectionTypeEnum.lpr.value ): continue From da7dd47436777b118a069f7c2d1943c00fbeac96 Mon Sep 17 00:00:00 2001 From: ryzendigo Date: Tue, 17 Mar 2026 16:11:36 +0800 Subject: [PATCH 2/3] fix: apply same or operator fix to review/maintainer.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Same issue as record/maintainer.py — the condition was always true because the bare enum value is truthy. --- frigate/review/maintainer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frigate/review/maintainer.py b/frigate/review/maintainer.py index a51c73f88..4dc1d8e6a 100644 --- a/frigate/review/maintainer.py +++ b/frigate/review/maintainer.py @@ -642,7 +642,10 @@ class ReviewSegmentMaintainer(threading.Thread): _, audio_detections, ) = data - elif topic == DetectionTypeEnum.api.value or DetectionTypeEnum.lpr.value: + elif ( + topic == DetectionTypeEnum.api.value + or topic == DetectionTypeEnum.lpr.value + ): ( camera, frame_time, From 18c23a1f6147392937ac984c5d5fbff357ff5418 Mon Sep 17 00:00:00 2001 From: ryzendigo Date: Tue, 17 Mar 2026 17:20:24 +0800 Subject: [PATCH 3/3] style: ruff format record/maintainer.py --- frigate/record/maintainer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frigate/record/maintainer.py b/frigate/record/maintainer.py index 26b64b2d3..6290a2405 100644 --- a/frigate/record/maintainer.py +++ b/frigate/record/maintainer.py @@ -727,7 +727,8 @@ class RecordingMaintainer(threading.Thread): ) ) elif ( - topic == DetectionTypeEnum.api.value or topic == DetectionTypeEnum.lpr.value + topic == DetectionTypeEnum.api.value + or topic == DetectionTypeEnum.lpr.value ): continue