From a3f8a0b524013b7c1eadd344ebe842985e79e79d Mon Sep 17 00:00:00 2001 From: Fintan Halpenny Date: Thu, 16 Feb 2023 15:40:32 +0000 Subject: [PATCH] Exchange From for TryFrom for PathBuf and Home The `From` implementation would allow someone to create a `Home` in an incorrect fashion, for example the path is not canonical. Exchange `From` for a `TryFrom` implementation. Signed-off-by: Fintan Halpenny X-Clacks-Overhead: GNU Terry Pratchett --- radicle-httpd/src/api/test.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/radicle-httpd/src/api/test.rs b/radicle-httpd/src/api/test.rs index 191794251..6feae6978 100644 --- a/radicle-httpd/src/api/test.rs +++ b/radicle-httpd/src/api/test.rs @@ -1,3 +1,4 @@ +use std::convert::TryInto as _; use std::path::Path; use std::str::FromStr; use std::sync::Arc; @@ -81,7 +82,8 @@ pub fn seed(dir: &Path) -> Context { .unwrap(); // eq. rad auth - let profile = radicle::Profile::init(rad_home.into(), PASSWORD.to_owned()).unwrap(); + let profile = + radicle::Profile::init(rad_home.try_into().unwrap(), PASSWORD.to_owned()).unwrap(); // rad init rad_init::init(