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.


b1499e6711/crates/oxc_language_server/src/main.rs (L531-L533)
This commit is contained in:
dalaoshu 2025-01-26 22:40:22 +08:00 committed by GitHub
parent 2fb08b9e9c
commit e85827b63f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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;
}