Return null for domain comment if this is what is stored in the database.

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER 2020-06-17 23:18:34 +02:00
parent 12112396f0
commit 5375ea0a62
No known key found for this signature in database
GPG Key ID: 00135ACBD90B28DD
2 changed files with 17 additions and 11 deletions

View File

@ -60,7 +60,12 @@ static int get_domainlist(struct mg_connection *conn, const int code, const int
JSON_OBJ_ADD_BOOL(item, "enabled", domain.enabled);
JSON_OBJ_ADD_NUMBER(item, "date_added", domain.date_added);
JSON_OBJ_ADD_NUMBER(item, "date_modified", domain.date_modified);
JSON_OBJ_COPY_STR(item, "comment", domain.comment);
if(domain.comment != NULL) {
JSON_OBJ_COPY_STR(item, "comment", domain.comment);
} else {
JSON_OBJ_ADD_NULL(item, "comment");
}
JSON_ARRAY_ADD_ITEM(json, item);
}
gravityDB_readTableFinalize();
@ -118,7 +123,8 @@ static int api_dns_domainlist_write(struct mg_connection *conn,
int data_len = mg_read(conn, buffer, sizeof(buffer) - 1);
if ((data_len < 1) || (data_len >= (int)sizeof(buffer))) {
return send_json_error(conn, 400,
"bad_request", "No request body data",
"bad_request",
"No request body data",
NULL);
}
buffer[data_len] = '\0';

View File

@ -672,9 +672,9 @@ int api_stats_history(struct mg_connection *conn)
free(forwarddest);
return send_json_error(conn, 400,
"bad_request",
"Requested upstream not found",
json);
"bad_request",
"Requested upstream not found",
json);
}
}
}
@ -760,9 +760,9 @@ int api_stats_history(struct mg_connection *conn)
free(clientname);
return send_json_error(conn, 400,
"bad_request",
"Requested client not found",
json);
"bad_request",
"Requested client not found",
json);
}
}
@ -785,9 +785,9 @@ int api_stats_history(struct mg_connection *conn)
free(clientname);
return send_json_error(conn, 400,
"bad_request",
"Requested cursor larger than number of queries",
json);
"bad_request",
"Requested cursor larger than number of queries",
json);
}
}