Don't add empty tags in get_tags().

This commit is contained in:
tastytea 2020-10-16 23:52:08 +02:00
parent f1d2c09c0b
commit 395b8efef2
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 8 additions and 2 deletions

View File

@ -110,8 +110,14 @@ vector<string> get_tags()
vector<string> tags_string;
cgi.getElement("tags[]", tags_form);
transform(tags_form.begin(), tags_form.end(), back_inserter(tags_string),
[](const auto &element) { return tolower(element.getValue()); });
for (const auto &element : tags_form)
{
const string_view tag{element.getValue()};
if (!tag.empty())
{
tags_string.push_back(tolower(tag));
}
}
return tags_string;
}