From c6e3d13e8cabaeab4e53ae01e0362279e6447f80 Mon Sep 17 00:00:00 2001 From: dadaloop82 Date: Mon, 4 May 2026 05:21:07 +0000 Subject: [PATCH] =?UTF-8?q?fix(api):=20bringAddItems()=20missing=20$input/?= =?UTF-8?q?$items=20decode=20=E2=80=94=20always=20returned=200?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bringAddItems() used $input and $items without ever decoding the request body. $items was undefined (null) so the foreach never ran, every call returned added=0 skipped=0 regardless of what was sent. Added: $input = json_decode(file_get_contents('php://input'), true) ?? []; $items = $input['items'] ?? []; Also added the missing $auth guard (consistent with all other Bring functions). --- api/index.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/api/index.php b/api/index.php index 5ac9f86..43e8b31 100644 --- a/api/index.php +++ b/api/index.php @@ -4672,6 +4672,13 @@ function bringGetList(): void { function bringAddItems(): void { $auth = bringAuth(); + if (!$auth) { + echo json_encode(['success' => false, 'error' => 'Credenziali Bring! non configurate']); + return; + } + + $input = json_decode(file_get_contents('php://input'), true) ?? []; + $items = $input['items'] ?? []; $listUUID = $input['listUUID'] ?? $auth['bringListUUID']; if (empty($listUUID)) {