fix(factory): Suppress ubus output to prevent JSON corruption in CGI responses

The factory_audit_log function's ubus call was only redirecting stderr,
allowing stdout JSON output to leak into CGI responses when Gitea backup
is enabled. This caused JSON parse errors in the Factory dashboard when
creating snapshots.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
CyberMind-FR 2026-02-03 04:17:48 +01:00
parent 045af683b3
commit c89e965631

View File

@ -289,9 +289,9 @@ factory_audit_log() {
echo "$(date -Iseconds 2>/dev/null || date)|$node_id|$action|$details" >> "$log_file"
# Push to Gitea if enabled
# Push to Gitea if enabled (suppress all output to avoid corrupting CGI responses)
if [ "$(uci -q get secubox-p2p.gitea.enabled)" = "1" ]; then
ubus call luci.secubox-p2p push_gitea_backup "{\"message\":\"Factory: $action\"}" 2>/dev/null
ubus call luci.secubox-p2p push_gitea_backup "{\"message\":\"Factory: $action\"}" >/dev/null 2>&1
fi
}