Bug fixing
This commit is contained in:
@@ -75,14 +75,14 @@ void PutHandler::handle_put_object(const httplib::Request& req, httplib::Respons
|
||||
}
|
||||
|
||||
// Validate each label:tag pair format
|
||||
for (const auto& label_tag : metadata["labeltags"]) {
|
||||
if (!label_tag.is_string()) {
|
||||
for (const auto& labeltag : metadata["labeltags"]) {
|
||||
if (!labeltag.is_string()) {
|
||||
res.status = 400;
|
||||
nlohmann::json response = {{"result", "error"}, {"error", "Invalid label:tag pair format - must be a string"}};
|
||||
res.set_content(response.dump(), "application/json");
|
||||
return;
|
||||
}
|
||||
std::string pair = label_tag.get<std::string>();
|
||||
std::string pair = labeltag.get<std::string>();
|
||||
if (pair.find(':') == std::string::npos) {
|
||||
res.status = 400;
|
||||
nlohmann::json response = {{"result", "error"}, {"error", "Invalid label:tag pair format - must contain ':' separator"}};
|
||||
@@ -165,7 +165,7 @@ void PutHandler::handle_put_object(const httplib::Request& req, httplib::Respons
|
||||
// Update database index
|
||||
dbEntry entry;
|
||||
entry.hash = std::to_string(hash);
|
||||
entry.label_tags = metadata["labeltags"].get<std::vector<std::string>>();
|
||||
entry.labeltags = metadata["labeltags"].get<std::vector<std::string>>();
|
||||
entry.metadata = metadata;
|
||||
|
||||
if (!server_.db_->update_or_insert(entry)) {
|
||||
|
Reference in New Issue
Block a user