diff --git a/tests/gateway/test_extract_local_files.py b/tests/gateway/test_extract_local_files.py index 1a1111f94..bbdaced6b 100644 --- a/tests/gateway/test_extract_local_files.py +++ b/tests/gateway/test_extract_local_files.py @@ -336,9 +336,35 @@ class TestEdgeCases: paths, _ = _extract("File at /tmp/my file.png here") assert paths == [] - def test_windows_path_not_matched(self): - """Windows-style paths should not match.""" - paths, _ = _extract("See C:\\Users\\test\\image.png") + @pytest.mark.parametrize( + "content,expected", + [ + # Backslash separators (native Windows style) + ("See C:\\Users\\test\\image.png here", "C:\\Users\\test\\image.png"), + # Forward slashes with drive letter (common in cross-platform code) + ("See C:/Users/test/image.png here", "C:/Users/test/image.png"), + # Non-C: drive + ("Video at D:/data/clip.mp4 ready", "D:/data/clip.mp4"), + # Lowercase drive letter + ("Path e:/audio/track.mp3 done", "e:/audio/track.mp3"), + ], + ) + def test_windows_drive_letter_paths_matched(self, content, expected): + """Windows drive-letter paths (C:/..., C:\\...) must be detected (#34632). + + Prior behavior anchored on (?:~/|/) only, which silently dropped + Windows absolute paths so the agent's bare-path references were + sent as text instead of native uploads. + """ + paths, cleaned = _extract(content) + assert paths == [expected] + assert expected not in cleaned + + def test_relative_windows_path_not_matched(self): + """A bare Windows-style filename without a drive letter must still + not match (e.g. ``foo\\bar.png`` is treated as relative, like its + Unix sibling ``foo/bar.png``).""" + paths, _ = _extract("File at foo\\bar.png here") assert paths == [] def test_relative_path_not_matched(self):