Fix Hex encoding of assets file digests
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-12-04 19:21:18 +01:00
parent 054fc0c4cc
commit b72fa90b67
3 changed files with 3 additions and 1 deletions

1
Cargo.lock generated
View File

@@ -588,6 +588,7 @@ dependencies = [
"clap",
"digest 0.11.0-rc.4",
"env_logger",
"hex",
"httpdate",
"include_dir",
"jwt-simple",

View File

@@ -41,3 +41,4 @@ lazy_static = "1.5.0"
mailchecker = "6.0.19"
httpdate = "1.0.3"
build-time = "0.1.3"
hex = "0.4.3"

View File

@@ -22,7 +22,7 @@ pub async fn assets_route(req: HttpRequest, path: web::Path<String>) -> HttpResp
None => HttpResponse::NotFound().body("404 Not found"),
Some(file) => {
let res = mime_guess::from_path(path).first_or_octet_stream();
let digest = format!("{:x?}", sha256(file.contents()));
let digest = hex::encode(sha256(file.contents()));
// Check if the browser already knows the file by date
if let Some(c) = req.headers().get(header::IF_MODIFIED_SINCE) {