mirror of
https://git.checksum.fail/alec/slon.git
synced 2025-12-08 12:09:55 +02:00
Slon/Api/V1/Accounts: Handle badly-behaved JSON API clients
An array of String is still an array, even if it contains a single element. I'm looking at you, [Tuba](https://github.com/GeopJr/Tuba/blob/main/src/API/Relationship.vala#L48). Ref: https://docs.joinmastodon.org/methods/accounts/#relationships It shouldn't be our responsibility to handle this, but life isn't fair, so we'll begrudgingly handle it anyway.
This commit is contained in:
@@ -158,7 +158,7 @@ U0 @slon_api_v1_accounts_get(SlonHttpSession* session)
|
|||||||
if (!StrICmp("relationships", session->path(3))) {
|
if (!StrICmp("relationships", session->path(3))) {
|
||||||
if (@slon_api_authorized(session)) {
|
if (@slon_api_authorized(session)) {
|
||||||
JsonArray* relationships = Json.CreateArray(slon_mem_task);
|
JsonArray* relationships = Json.CreateArray(slon_mem_task);
|
||||||
JsonArray* relationship_of_ids = request_json->@("id");
|
JsonArray* relationship_of_ids = Json.KeyValueAsArray(request_json->@("id", 1), slon_mem_task);
|
||||||
JsonObject* target_account = NULL;
|
JsonObject* target_account = NULL;
|
||||||
if (relationship_of_ids) {
|
if (relationship_of_ids) {
|
||||||
for (i = 0; i < relationship_of_ids->length; i++) {
|
for (i = 0; i < relationship_of_ids->length; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user