remove malformed clutter from webcam status0 JSON response (#23177)

A regression was added in commit 01154e949, which prepends
clutter to the status0 JSON status message.

Example:
```
$ curl 'http://webcam/cm?cmnd=Status0' -u admin:password ; echo
{s}Webcam Frame rate{m}0 FPS{e}{"Status":{"Module":0,"DeviceName":"...
```

The response is not properly formatted JSON and breaks client software.

The problem occurs because a new case statement was added for the
purpose of injecting webcam stats into the JSON status message, but
a break statement is missing and execution falls through to the
following case, which prepends garbage to the output buffer.

With this one-line fix in place, the output is properly formatted:
```
$ curl 'http://tahoe-front-door-cam/cm?cmnd=Status0' -u admin:password ; echo
{"Status":{"Module":0,"DeviceName":"
```

Note that the prior case for FUNC_EVERY_SECOND is also missing a break
statement. That looks wrong to me but it's unrelated to fixing this
issue and I'm inclined to punt that concern to others who are more
familiar with this code.
This commit is contained in:
DavidPletcher 2025-03-22 00:18:01 -07:00 committed by GitHub
parent 8183a9ed3b
commit 3827bca3cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1577,6 +1577,7 @@ bool Xdrv81(uint32_t function) {
WcUpdateStats();
case FUNC_JSON_APPEND:
WcSensorStats();
break;
case FUNC_WEB_SENSOR:
WcStatsShow();
break;