From f658dbb158558fb249b67c9992aadff0f1c7f59d Mon Sep 17 00:00:00 2001 From: ryzendigo <48058157+ryzendigo@users.noreply.github.com> Date: Wed, 18 Mar 2026 22:40:54 +0800 Subject: [PATCH] fix: operator precedence makes detection type check always true (#22471) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 * fix: apply same or operator fix to review/maintainer.py Same issue as record/maintainer.py — the condition was always true because the bare enum value is truthy. * style: ruff format record/maintainer.py --- frigate/record/maintainer.py | 3 ++- frigate/review/maintainer.py | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/frigate/record/maintainer.py b/frigate/record/maintainer.py index 68040476a..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 DetectionTypeEnum.lpr.value + topic == DetectionTypeEnum.api.value + or topic == DetectionTypeEnum.lpr.value ): continue 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,