mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-09-23 17:52:05 +02:00
Catch exception when regex in LPR format field is invalid (#20099)
This commit is contained in:
parent
5f34a18905
commit
975c8485f9
@ -385,11 +385,18 @@ class LicensePlateProcessingMixin:
|
||||
)
|
||||
continue
|
||||
|
||||
if self.lpr_config.format and not re.fullmatch(
|
||||
self.lpr_config.format, plate
|
||||
):
|
||||
logger.debug(f"Filtered out '{plate}' due to format mismatch")
|
||||
continue
|
||||
if self.lpr_config.format:
|
||||
try:
|
||||
if not re.fullmatch(self.lpr_config.format, plate):
|
||||
logger.debug(
|
||||
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))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user