diff --git a/Cargo.lock b/Cargo.lock index 9ecf5b1..e0f470c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -588,6 +588,7 @@ dependencies = [ "clap", "digest 0.11.0-rc.4", "env_logger", + "hex", "httpdate", "include_dir", "jwt-simple", diff --git a/Cargo.toml b/Cargo.toml index 01f67cf..c76180c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/src/controllers/assets_controller.rs b/src/controllers/assets_controller.rs index d8544c7..2cc0a2e 100644 --- a/src/controllers/assets_controller.rs +++ b/src/controllers/assets_controller.rs @@ -22,7 +22,7 @@ pub async fn assets_route(req: HttpRequest, path: web::Path) -> 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) {