From d8b970bb47a7f4549aaaf629b40d5c85c3aaca89 Mon Sep 17 00:00:00 2001 From: Tyler Cook <10459406+cilki@users.noreply.github.com> Date: Sun, 17 Mar 2024 15:31:47 -0500 Subject: [PATCH] chore: release --- goldboot/build.rs | 15 +++++++-------- goldboot/src/registry/extract.rs | 15 --------------- 2 files changed, 7 insertions(+), 23 deletions(-) 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) {