diff --git a/goldboot/build.rs b/goldboot/build.rs index 13130ff..7b4e666 100644 --- a/goldboot/build.rs +++ b/goldboot/build.rs @@ -1,11 +1,10 @@ -use std::{ - env, - path::{Path, PathBuf}, -}; +use std::{env, path::PathBuf}; fn main() { - let dest = - std::path::Path::new(&env::var("OUT_DIR").expect("OUT_DIR not set")).join("built.rs"); - built::write_built_file_with_opts(Some(&PathBuf::from("..")), &dest) - .expect("Failed to acquire build-time information"); + if built::write_built_file().is_err() { + let dest = + std::path::Path::new(&env::var("OUT_DIR").expect("OUT_DIR not set")).join("built.rs"); + built::write_built_file_with_opts(Some(&PathBuf::from("..")), &dest) + .expect("Failed to acquire build-time information"); + } } diff --git a/goldboot/src/registry/extract.rs b/goldboot/src/registry/extract.rs index dcb811b..af31c7a 100644 --- a/goldboot/src/registry/extract.rs +++ b/goldboot/src/registry/extract.rs @@ -21,21 +21,6 @@ impl FromRequest for ImageHandle { type Rejection = StatusCode; async fn from_request(req: Request, state: &RegistryState) -> Result { - let (mut parts, body) = req.into_parts(); - - // We can use other extractors to provide better rejection messages. - // For example, here we are using `axum::extract::MatchedPath` to - // provide a better error message. - // - // Have to run that first since `Json` extraction consumes the request. - let path = parts - .extract::() - .await - .map(|path| path.as_str().to_owned()) - .ok(); - - let req = Request::from_parts(parts, body); - match Path::>::from_request(req, state).await { Ok(value) => match value.get("image_id") { Some(image_id) => match ImageLibrary::find_by_id(image_id) {