From e5ca922ce83dcad305a71b122235e0aa1757dc58 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Sat, 4 Jan 2025 12:27:04 -0800 Subject: [PATCH] fix: handle empty paths and dotfiles in get_ident_filename_matches --- aider/coders/base_coder.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/aider/coders/base_coder.py b/aider/coders/base_coder.py index ab662aebd..c4633a705 100755 --- a/aider/coders/base_coder.py +++ b/aider/coders/base_coder.py @@ -613,9 +613,19 @@ class Coder: def get_ident_filename_matches(self, idents): all_fnames = defaultdict(set) for fname in self.get_all_relative_files(): - base = Path(fname).with_suffix("").name.lower() - if len(base) >= 5: - all_fnames[base].add(fname) + # Skip empty paths or just '.' + if not fname or fname == '.': + continue + + try: + # Handle dotfiles properly + path = Path(fname) + base = path.stem.lower() # Use stem instead of with_suffix("").name + if len(base) >= 5: + all_fnames[base].add(fname) + except ValueError: + # Skip paths that can't be processed + continue matches = set() for ident in idents: