From e63ef09d229a41471acfb9d171e4dc91516257db Mon Sep 17 00:00:00 2001 From: Ben Bridle Date: Mon, 28 Oct 2024 19:05:23 +1300 Subject: Fix error when opening a path ending with a relative component This was thought to be impossible, but it was found to trigger when opening the parent directory of a relative path in the form './file'. --- src/entry.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/entry.rs') diff --git a/src/entry.rs b/src/entry.rs index 6ea78bc..b59ced5 100644 --- a/src/entry.rs +++ b/src/entry.rs @@ -37,8 +37,8 @@ impl Entry { }; let name = match path.file_name() { - Some(osstr) => osstr.to_string_lossy().to_string(), - None => unreachable!(), + Some(os_str) => os_str.to_string_lossy().to_string(), + None => path.to_string_lossy().to_string(), }; let extension = match path.extension() { Some(extension) => extension.to_string_lossy().into(), -- cgit v1.2.3-70-g09d2