From 360e23e4b4216e1d06e194146f4fa60a4db55514 Mon Sep 17 00:00:00 2001 From: Juha Kukkonen Date: Wed, 22 May 2024 01:13:49 +0300 Subject: [PATCH] Fix docs.rs build Skip Swagger UI download on docs.rs build since it is sandboxed environment. --- utoipa-swagger-ui/Cargo.toml | 2 +- utoipa-swagger-ui/build.rs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/utoipa-swagger-ui/Cargo.toml b/utoipa-swagger-ui/Cargo.toml index e3c7c30a..2e502f42 100644 --- a/utoipa-swagger-ui/Cargo.toml +++ b/utoipa-swagger-ui/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "utoipa-swagger-ui" description = "Swagger UI for utoipa" -version = "7.0.2" +version = "7.0.3" edition = "2021" license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/utoipa-swagger-ui/build.rs b/utoipa-swagger-ui/build.rs index 742a329e..90b2acab 100644 --- a/utoipa-swagger-ui/build.rs +++ b/utoipa-swagger-ui/build.rs @@ -26,6 +26,10 @@ const SWAGGER_UI_DOWNLOAD_URL: &str = "SWAGGER_UI_DOWNLOAD_URL"; const SWAGGER_UI_OVERWRITE_FOLDER: &str = "SWAGGER_UI_OVERWRITE_FOLDER"; fn main() { + if env::var("DOCS_RS").is_ok() { + println!("running docs.rs build, skip Swagger UI download, sandboxed environment"); + return; + } let target_dir = env::var("OUT_DIR").unwrap(); println!("OUT_DIR: {target_dir}");