From 3827bca3cc2f6ca5ee20d952b2051aafcb664604 Mon Sep 17 00:00:00 2001 From: DavidPletcher Date: Sat, 22 Mar 2025 00:18:01 -0700 Subject: [PATCH] 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. --- tasmota/tasmota_xdrv_driver/xdrv_81_esp32_webcam.ino | 1 + 1 file changed, 1 insertion(+) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_81_esp32_webcam.ino b/tasmota/tasmota_xdrv_driver/xdrv_81_esp32_webcam.ino index 951f95e94..7271af9b5 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_81_esp32_webcam.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_81_esp32_webcam.ino @@ -1577,6 +1577,7 @@ bool Xdrv81(uint32_t function) { WcUpdateStats(); case FUNC_JSON_APPEND: WcSensorStats(); + break; case FUNC_WEB_SENSOR: WcStatsShow(); break;