mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-09-26 19:41:29 +08:00
Catch exception when regex in LPR format field is invalid (#20099)
This commit is contained in:
@@ -385,11 +385,18 @@ class LicensePlateProcessingMixin:
|
|||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if self.lpr_config.format and not re.fullmatch(
|
if self.lpr_config.format:
|
||||||
self.lpr_config.format, plate
|
try:
|
||||||
):
|
if not re.fullmatch(self.lpr_config.format, plate):
|
||||||
logger.debug(f"Filtered out '{plate}' due to format mismatch")
|
logger.debug(
|
||||||
continue
|
f"Filtered out '{plate}' due to format mismatch"
|
||||||
|
)
|
||||||
|
continue
|
||||||
|
except re.error:
|
||||||
|
# Skip format filtering if regex is invalid
|
||||||
|
logger.error(
|
||||||
|
f"{camera}: Invalid regex in LPR format configuration: {self.lpr_config.format}"
|
||||||
|
)
|
||||||
|
|
||||||
filtered_data.append((plate, conf_list, area))
|
filtered_data.append((plate, conf_list, area))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user