From e85827b63f1971d8d149c20d36d8048720a28281 Mon Sep 17 00:00:00 2001 From: dalaoshu Date: Sun, 26 Jan 2025 22:40:22 +0800 Subject: [PATCH] fix(oxc_language_server): use `file_path` instead of `uri_path` (#8736) closes #8594 This is because previously, oxlintrc.path was determined by `path.canonicalize().unwrap_or_else(|_| path.to_path_buf())`, but after #8214, it was changed to `path.to_path_buf()`. As a result, `\\?\D:\shulaoda` became `D:\shulaoda`. This caused the condition `uri_path.starts_with(gitignore.path())` to evaluate as `true`, preventing the bypass of the `is_ignore` check and exposing the original code issue. https://github.com/oxc-project/oxc/blob/b1499e6711e3e79053b86192cb6a635000abc23b/crates/oxc_language_server/src/main.rs#L531-L533 --- crates/oxc_language_server/src/main.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/crates/oxc_language_server/src/main.rs b/crates/oxc_language_server/src/main.rs index 431f3732a..7da5f47f9 100644 --- a/crates/oxc_language_server/src/main.rs +++ b/crates/oxc_language_server/src/main.rs @@ -531,11 +531,7 @@ impl Backend { if !uri_path.starts_with(gitignore.path()) { continue; } - - let path = PathBuf::from(uri.path()); - let ignored = - gitignore.matched_path_or_any_parents(&path, path.is_dir()).is_ignore(); - if ignored { + if gitignore.matched_path_or_any_parents(&uri_path, uri_path.is_dir()).is_ignore() { debug!("ignored: {uri}"); return true; }