Pass cgicc::Cgicc object to get_array().
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
27f05636cd
commit
172aabfb69
|
@ -84,7 +84,7 @@ entry_type parse_formdata()
|
|||
}
|
||||
else
|
||||
{
|
||||
entry.tags = get_array("tags[]");
|
||||
entry.tags = get_array("tags[]", cgi);
|
||||
}
|
||||
transform(entry.tags.begin(), entry.tags.end(), entry.tags.begin(),
|
||||
[](const auto &tag) { return tolower(tag); });
|
||||
|
@ -96,7 +96,7 @@ entry_type parse_formdata()
|
|||
}
|
||||
else
|
||||
{
|
||||
entry.receipts = get_array("receipts[]");
|
||||
entry.receipts = get_array("receipts[]", cgi);
|
||||
}
|
||||
|
||||
entry.description = cgi("description");
|
||||
|
@ -161,9 +161,8 @@ vector<string> string_to_vector(const string_view str)
|
|||
return vec;
|
||||
}
|
||||
|
||||
vector<string> get_array(const string &name)
|
||||
vector<string> get_array(const string &name, cgicc::Cgicc &cgi)
|
||||
{
|
||||
cgicc::Cgicc cgi;
|
||||
vector<cgicc::FormEntry> form;
|
||||
vector<string> values;
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
#include "types.hpp"
|
||||
|
||||
#include <cgicc/Cgicc.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <exception>
|
||||
#include <string>
|
||||
|
@ -41,9 +43,12 @@ using std::vector;
|
|||
/*!
|
||||
* @brief Read array from QUERY_STRING or stdin and return it as a vector.
|
||||
*
|
||||
* @param name name of the argument to read.
|
||||
* @param cgi Reference to a cgicc:Cgicc object.
|
||||
*
|
||||
* @since 0.1.0
|
||||
*/
|
||||
[[nodiscard]] vector<string> get_array(const string &name);
|
||||
[[nodiscard]] vector<string> get_array(const string &name, cgicc::Cgicc &cgi);
|
||||
|
||||
// Return str in lowercase.
|
||||
[[nodiscard]] string tolower(string_view str);
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "git.hpp"
|
||||
#include "time.hpp"
|
||||
|
||||
#include <cgicc/Cgicc.h>
|
||||
#include <fmt/format.h>
|
||||
#include <pugixml.hpp>
|
||||
|
||||
|
@ -222,7 +223,8 @@ int main(int /*argc*/, char * /*argv*/[])
|
|||
// Ignore, use old version of repo.
|
||||
}
|
||||
const auto entries{files::read_json_files(true)};
|
||||
write_rss(cout, entries, cgi::get_array("tags[]"));
|
||||
cgicc::Cgicc cgi;
|
||||
write_rss(cout, entries, cgi::get_array("tags[]", cgi));
|
||||
}
|
||||
catch (const exception &e)
|
||||
{
|
||||
|
|
Reference in New Issue