From 5bc1ba910f5e2515bbcd3c2a5562b5f925f9ad5d Mon Sep 17 00:00:00 2001 From: Chris Hennick <4961925+Pr0methean@users.noreply.github.com> Date: Wed, 12 Jun 2024 21:39:06 -0700 Subject: [PATCH] fix: path_to_string now properly handles the case of an empty path --- src/spec.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/spec.rs b/src/spec.rs index 8a6feff0..d77c6daa 100644 --- a/src/spec.rs +++ b/src/spec.rs @@ -653,6 +653,9 @@ pub(crate) fn is_dir(filename: &str) -> bool { pub(crate) fn path_to_string>(path: T) -> Box { let mut maybe_original = None; if let Some(original) = path.as_ref().to_str() { + if (original.len() == 0) { + return String::new().into_boxed_str(); + } if (MAIN_SEPARATOR == '/' || !original[1..].contains(MAIN_SEPARATOR)) && !original.ends_with('.') && !original.starts_with(['.', MAIN_SEPARATOR])