Bug fixing

This commit is contained in:
Your Name
2025-05-25 13:11:13 +12:00
parent 7b3706ebf5
commit f1d6fe661a
5 changed files with 37 additions and 39 deletions

View File

@@ -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)) {