fix garbage completion with partial directory name and trailing /

This commit is contained in:
rabite0 2020-02-29 03:09:16 +01:00
parent 853cf534a7
commit d18836d0bf
1 changed files with 5 additions and 0 deletions

View File

@ -392,6 +392,11 @@ pub fn find_files(comp_name: &str) -> HResult<Vec<OsString>> {
let comp_path = std::path::PathBuf::from(&comp_name);
path.push(&comp_path);
// Tried to complete on an incorrect path
if comp_name.ends_with("/") && !path.is_dir() {
return Err(HError::NoCompletionsError)
}
let comp_name = OsStr::new(comp_name);
let filename_part = path.file_name()?;