test: Add 4 and update 6 files
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#include "utils.hpp"
|
||||
#include "welcome_page.hpp"
|
||||
#include "rate_limiter.hpp"
|
||||
#include "validation.hpp"
|
||||
#include "HttpController.hpp"
|
||||
#include "bcrypt.hpp" // For secure token hashing
|
||||
|
||||
@@ -415,6 +416,18 @@ void Server::handle_delete_object(const drogon::HttpRequestPtr& req, std::functi
|
||||
return;
|
||||
}
|
||||
|
||||
// Validate hash format
|
||||
auto hashValidation = InputValidator::validateHash(params["hash"]);
|
||||
if (!hashValidation.valid) {
|
||||
resp->setStatusCode(drogon::k400BadRequest);
|
||||
nlohmann::json response = {{"result", "error"}, {"error", "Invalid hash: " + hashValidation.error}};
|
||||
resp->setBody(response.dump());
|
||||
resp->setContentTypeCode(drogon::CT_APPLICATION_JSON);
|
||||
add_security_headers(resp);
|
||||
callback(resp);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!db_->get(params["hash"], entry)) {
|
||||
resp->setStatusCode(drogon::k404NotFound);
|
||||
nlohmann::json response = {{"result", "error"}, {"error", "Object not found for: " + params["hash"]}};
|
||||
|
Reference in New Issue
Block a user