mistrust: Canonicalise prefix from Some("") to None

This allows us to add the proper default example to the arti example
config file.
This commit is contained in:
Ian Jackson 2022-05-27 17:10:40 +01:00
parent ca60859dff
commit 0a324f843f
2 changed files with 2 additions and 0 deletions

View File

@ -97,6 +97,7 @@
# (This is not the default.)
#
# ignore_prefix = "/home/"
#ignore_prefix = ""
# Replacement values for consensus parameters. This is an advanced option
# and you probably should leave it alone. Not all parameters are supported.

View File

@ -358,6 +358,7 @@ pub struct Mistrust {
#[allow(clippy::option_option)]
fn canonicalize_opt_prefix(prefix: &Option<Option<PathBuf>>) -> Result<Option<PathBuf>> {
match prefix {
Some(Some(path)) if path.as_os_str().is_empty() => Ok(None),
Some(Some(path)) => Ok(Some(
path.canonicalize()
.map_err(|e| Error::inspecting(e, path))?,