fix: prevent massive ADR list projection on empty buffers
This commit is contained in:
1 parent
827f0dd511
commit
4342615649
1 file changed
+7
@@ -27,6 +27,13 @@ pub fn find_projected_knowledge(
|
|||||||
file_path: &str,
|
file_path: &str,
|
||||||
) -> (Vec<ProjectedTechDebt>, Vec<ProjectedAdr>) {
|
) -> (Vec<ProjectedTechDebt>, Vec<ProjectedAdr>) {
|
||||||
let normalized_file = file_path.replace('\\', "/").to_lowercase();
|
let normalized_file = file_path.replace('\\', "/").to_lowercase();
|
||||||
|
|
||||||
|
// An empty file path matches everything due to `ends_with("")` behavior.
|
||||||
|
// Return empty results immediately for [No Name] buffers.
|
||||||
|
if normalized_file.trim().is_empty() {
|
||||||
|
return (Vec::new(), Vec::new());
|
||||||
|
}
|
||||||
|
|
||||||
let file_name = std::path::Path::new(&normalized_file)
|
let file_name = std::path::Path::new(&normalized_file)
|
||||||
.file_name()
|
.file_name()
|
||||||
.and_then(|n| n.to_str())
|
.and_then(|n| n.to_str())
|
||||||
|
|||||||
Reference in new issue
Block a user