Files
FTL/test/api
010011110 f82d0a7dfc Reply with the new name after renaming a group, and fail a rename that matched no group
PUT /api/groups/{name} with a different "name" in the payload runs
UPDATE "group" SET name = :name ... WHERE name = :item, so the row is
renamed, but `api_list_write()` handed the URI name on as the reply item
and built the Location header from it. `api_list_read()` then selected
WHERE name = :item, found nothing, and the client got a 200 with an empty
groups array and a Location pointing at a group that no longer exists,
although groups.yaml promises a body identical to GET.

The same UPDATE was counted as a success whenever it stepped to
SQLITE_DONE, including when it matched no row, so PUT on a nonexistent
group with a name in the payload was a silent no-op reported as
processed.success. And since any non-empty "name" took that branch, even
one equal to the URI item, the create-or-update the spec documents for
PUT only ever worked for a payload without a "name" - which the spec
marks as required.

`addToTable()` now takes the upsert whenever the name is absent or equal
to the URI item, and reports "Group not found" when the rename changed no
row; `api_list_write()` turns that into the usual 400 database_error.
After a successful write the reply item and the Location header carry the
name the group has now.

Signed-off-by: 010011110 <duckenheim@posteo.de>
2026-09-22 08:23:56 +02:00
..
2026-05-06 19:10:21 +02:00