test: Add 4 and update 6 files
All checks were successful
Build-Test-Publish / build (linux/amd64) (push) Successful in 1m23s
Build-Test-Publish / build (linux/arm64) (push) Successful in 2m21s
Build-Test-Publish / create-manifest (push) Successful in 12s

This commit is contained in:
Your Name
2025-08-10 23:31:41 +12:00
parent 22d4af7ac8
commit baa215e762
10 changed files with 978 additions and 23 deletions

View File

@@ -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"]}};