mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-07-15 00:11:15 +03:00
add guards to reject missing sub commands
This commit is contained in:
parent
adc8c2a6e8
commit
a7f70e1334
@ -1224,6 +1224,15 @@ def camera_set(
|
||||
status_code=400,
|
||||
)
|
||||
|
||||
if not sub_command and feature in _SUB_COMMAND_FEATURES:
|
||||
return JSONResponse(
|
||||
content={
|
||||
"success": False,
|
||||
"message": f"Feature '{feature}' requires a sub-command (e.g. mask or zone name)",
|
||||
},
|
||||
status_code=400,
|
||||
)
|
||||
|
||||
if camera_name == "*":
|
||||
cameras = list(frigate_config.cameras.keys())
|
||||
elif camera_name not in frigate_config.cameras:
|
||||
|
||||
@ -118,10 +118,21 @@ class Dispatcher:
|
||||
|
||||
try:
|
||||
if command_type == "set":
|
||||
# Commands that require a sub-command (mask/zone name)
|
||||
sub_command_required = {
|
||||
"motion_mask",
|
||||
"object_mask",
|
||||
"zone",
|
||||
}
|
||||
if sub_command:
|
||||
self._camera_settings_handlers[command](
|
||||
camera_name, sub_command, payload
|
||||
)
|
||||
elif command in sub_command_required:
|
||||
logger.error(
|
||||
"Command %s requires a sub-command (mask/zone name)",
|
||||
command,
|
||||
)
|
||||
else:
|
||||
self._camera_settings_handlers[command](camera_name, payload)
|
||||
elif command_type == "ptz":
|
||||
|
||||
Loading…
Reference in New Issue
Block a user