fix: prevent massive ADR list projection on empty buffers

This commit is contained in:
Riz Ashraf committed 2026-10-10 22:10:36 +01:00
1 parent 827f0dd511
commit 4342615649
1 file changed
+7
+7
View File
@@ -27,6 +27,13 @@ pub fn find_projected_knowledge(
file_path: &str,
) -> (Vec<ProjectedTechDebt>, Vec<ProjectedAdr>) {
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)
.file_name()
.and_then(|n| n.to_str())