Don't crash if we can't canonicalise the path.
This commit is contained in:
parent
3009a5feaf
commit
779ba9c7a7
1 changed files with 1 additions and 1 deletions
|
|
@ -43,7 +43,7 @@ impl TryFrom<PathBuf> for StorePath {
|
||||||
type Error = anyhow::Error;
|
type Error = anyhow::Error;
|
||||||
|
|
||||||
fn try_from(path: PathBuf) -> Result<Self> {
|
fn try_from(path: PathBuf) -> Result<Self> {
|
||||||
let canon = path.canonicalize()?;
|
let canon = path.canonicalize().unwrap_or(path.clone());
|
||||||
if !canon.starts_with(PathBuf::from("/").join("nix").join("store")) {
|
if !canon.starts_with(PathBuf::from("/").join("nix").join("store")) {
|
||||||
anyhow::bail!(
|
anyhow::bail!(
|
||||||
"Error constructing store path, not in store: {} (canonicalised: {})",
|
"Error constructing store path, not in store: {} (canonicalised: {})",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue