fix: disallow empty tags
This commit is contained in:
parent
f98a01f3f0
commit
6117548e32
3 changed files with 16 additions and 1 deletions
src/endpoints
|
@ -70,6 +70,16 @@ api_v1_tags_POST(struct mg_connection *nc, struct http_message *hm, endpoint_arg
|
|||
return;
|
||||
}
|
||||
|
||||
if(strlen(json_tag->valuestring) == 0)
|
||||
{
|
||||
LOGGER_DEBUG("tag is empty\n");
|
||||
cJSON_Delete(json);
|
||||
|
||||
static const char content[] = "tag is empty";
|
||||
endpoint_response_text(response, 400, content, STRLEN(content));
|
||||
return;
|
||||
}
|
||||
|
||||
if(tag_save(0, json_tag->valuestring))
|
||||
{
|
||||
LOGGER_DEBUG("tag could not be saved\n");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue