From a1438393354caf147b6e2511615cb2234d560e72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Orhun=20Parmaks=C4=B1z?= Date: Wed, 27 Mar 2024 14:21:19 +0300 Subject: [PATCH 1/4] fix: canonicalize the output directory before checks --- src/lib.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 7e5a560d..f3e78a5e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -133,11 +133,13 @@ pub async fn get_build_output( recipe_path: PathBuf, tool_config: &Configuration, ) -> miette::Result> { - let output_dir = args - .common - .output_dir - .clone() - .unwrap_or(current_dir().into_diagnostic()?.join("output")); + let output_dir = canonicalize( + args.common + .output_dir + .clone() + .unwrap_or(current_dir().into_diagnostic()?.join("output")), + ) + .into_diagnostic()?; if output_dir.starts_with( recipe_path .parent() From 2b884b433c7e9efddfece52655b27c3b2b76bded Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Orhun=20Parmaks=C4=B1z?= Date: Wed, 27 Mar 2024 14:48:53 +0300 Subject: [PATCH 2/4] refactor: only canonicalize for checks --- src/lib.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index f3e78a5e..70d7434b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -133,14 +133,12 @@ pub async fn get_build_output( recipe_path: PathBuf, tool_config: &Configuration, ) -> miette::Result> { - let output_dir = canonicalize( - args.common - .output_dir - .clone() - .unwrap_or(current_dir().into_diagnostic()?.join("output")), - ) - .into_diagnostic()?; - if output_dir.starts_with( + let output_dir = args + .common + .output_dir + .clone() + .unwrap_or(current_dir().into_diagnostic()?.join("output")); + if canonicalize(&output_dir).into_diagnostic()?.starts_with( recipe_path .parent() .expect("Could not get parent of recipe"), From ca98f6e53df3a474b90cb42600e70d94d7b885b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Orhun=20Parmaks=C4=B1z?= Date: Wed, 27 Mar 2024 16:48:19 +0300 Subject: [PATCH 3/4] fix: add guard in case output dir does not exist --- src/lib.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 70d7434b..48629e8e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -133,12 +133,15 @@ pub async fn get_build_output( recipe_path: PathBuf, tool_config: &Configuration, ) -> miette::Result> { - let output_dir = args + let mut output_dir = args .common .output_dir .clone() .unwrap_or(current_dir().into_diagnostic()?.join("output")); - if canonicalize(&output_dir).into_diagnostic()?.starts_with( + if output_dir.exists() { + output_dir = canonicalize(&output_dir).into_diagnostic()?; + } + if output_dir.starts_with( recipe_path .parent() .expect("Could not get parent of recipe"), From fbaaa2b43e494c04f668550e99a932a7afba3bf1 Mon Sep 17 00:00:00 2001 From: Wolf Vollprecht Date: Tue, 2 Apr 2024 14:38:02 +0200 Subject: [PATCH 4/4] fix warning in pixi.toml --- pixi.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pixi.toml b/pixi.toml index 4af772c3..45eab880 100644 --- a/pixi.toml +++ b/pixi.toml @@ -32,6 +32,6 @@ conda-package-handling = "2.2.0.*" # Documentation building mkdocs = "1.5.3.*" mkdocs-material = "9.5.*" -pillow = ">=9.4.0.*" +pillow = ">=9.4.0" cairosvg = "2.7.1.*" mike = "2.0.0.*"