From 74e76a94cabefcf506ccc8314be752c64b21e51d Mon Sep 17 00:00:00 2001 From: Chris Hennick <4961925+Pr0methean@users.noreply.github.com> Date: Fri, 3 May 2024 15:01:43 -0700 Subject: [PATCH] chore: Refactor: can short-circuit handling of paths that start with MAIN_SEPARATOR, no matter what MAIN_SEPARATOR is --- src/spec.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spec.rs b/src/spec.rs index e9cd6ea7..8e305235 100644 --- a/src/spec.rs +++ b/src/spec.rs @@ -219,7 +219,7 @@ impl Zip64CentralDirectoryEnd { pub(crate) fn path_to_string>(path: T) -> String { let mut maybe_original = None; if let Some(original) = path.as_ref().to_str() { - if (MAIN_SEPARATOR == '/' || !original.contains(MAIN_SEPARATOR)) + if (MAIN_SEPARATOR == '/' || !original[1..].contains(MAIN_SEPARATOR)) && !original.ends_with('.') && !original.starts_with(['.', MAIN_SEPARATOR]) && !original.starts_with(['.', '.', MAIN_SEPARATOR])