From 90b5b229c2df9c34758807eaf0490647a3c02e34 Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy Date: Mon, 28 Mar 2022 00:59:48 +0200 Subject: [PATCH] fix(find): Strip excess `./` from file path prefix --- plugins/src/find/mod.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/src/find/mod.rs b/plugins/src/find/mod.rs index aa4f3be..85434bf 100644 --- a/plugins/src/find/mod.rs +++ b/plugins/src/find/mod.rs @@ -126,7 +126,12 @@ impl SearchContext { .map(|pos| line[pos + 1..].to_owned()) .unwrap_or_else(|| line.clone()); - let description = ["~/", line.as_str()].concat(); + let line = match line.strip_prefix("./") { + Some(line) => line, + None => line.as_str(), + }; + + let description = ["~/", line].concat(); let path = PathBuf::from(line);