0

[py]: Fix issue with LocalFileDetector returning the path for files that do not exist

NOKEYCHECK=True
GitOrigin-RevId: ca3203128f0a5d65342d5e80b62dee10d29d2afb
This commit is contained in:
symonk
2023-08-09 21:17:26 +01:00
committed by Copybara-Service
parent 302923e1ad
commit f2285b17a5

@@ -46,6 +46,7 @@ class LocalFileDetector(FileDetector):
def is_local_file(self, *keys: AnyKey) -> Optional[str]:
file_path = "".join(keys_to_typing(keys))
with suppress(OSError):
_ = Path(file_path).is_file()
return file_path
if Path(file_path).is_file():
return file_path