Fix Hex encoding of assets file digests
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -588,6 +588,7 @@ dependencies = [
|
|||||||
"clap",
|
"clap",
|
||||||
"digest 0.11.0-rc.4",
|
"digest 0.11.0-rc.4",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
|
"hex",
|
||||||
"httpdate",
|
"httpdate",
|
||||||
"include_dir",
|
"include_dir",
|
||||||
"jwt-simple",
|
"jwt-simple",
|
||||||
|
|||||||
@@ -41,3 +41,4 @@ lazy_static = "1.5.0"
|
|||||||
mailchecker = "6.0.19"
|
mailchecker = "6.0.19"
|
||||||
httpdate = "1.0.3"
|
httpdate = "1.0.3"
|
||||||
build-time = "0.1.3"
|
build-time = "0.1.3"
|
||||||
|
hex = "0.4.3"
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ pub async fn assets_route(req: HttpRequest, path: web::Path<String>) -> HttpResp
|
|||||||
None => HttpResponse::NotFound().body("404 Not found"),
|
None => HttpResponse::NotFound().body("404 Not found"),
|
||||||
Some(file) => {
|
Some(file) => {
|
||||||
let res = mime_guess::from_path(path).first_or_octet_stream();
|
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
|
// Check if the browser already knows the file by date
|
||||||
if let Some(c) = req.headers().get(header::IF_MODIFIED_SINCE) {
|
if let Some(c) = req.headers().get(header::IF_MODIFIED_SINCE) {
|
||||||
|
|||||||
Reference in New Issue
Block a user