From ac149afac98dc8048a5c28ed849618add0e2cff8 Mon Sep 17 00:00:00 2001 From: Dominik Jain Date: Fri, 22 Aug 2025 14:13:55 +0200 Subject: [PATCH] Add further exception handle for relative path conversion, accounting for paths which are not deemed 'absolute' (apparently NUL file on Windows satisfies this) #517 --- src/serena/project.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/serena/project.py b/src/serena/project.py index f5fea2f5..47559d9b 100644 --- a/src/serena/project.py +++ b/src/serena/project.py @@ -192,7 +192,11 @@ class Project: abs_file_path = os.path.join(root, file) try: if not self.is_ignored_path(abs_file_path): - rel_file_path = os.path.relpath(abs_file_path, start=self.project_root) + try: + rel_file_path = os.path.relpath(abs_file_path, start=self.project_root) + except Exception as e: + log.warning("Ignoring path '%s' because it appears to be outside of the project root (%s)", abs_file_path, self.project_root) + continue rel_file_paths.append(rel_file_path) except FileNotFoundError: log.warning(