fs: Handle io::ErrorKind::NotADirectory in fs::metadata (#42370)

New error variants were stabilized in 1.83, and this might've led to us
mis-handling not-a-directory errors.

Co-authored-by: Dino <dino@zed.dev>

Release Notes:

- N/A

Co-authored-by: Dino <dino@zed.dev>
This commit is contained in:
Piotr Osiewicz
2025-11-10 18:18:40 +01:00
committed by GitHub
co-authored by Dino
parent a3f04e8b36
commit 6e1d86f311
+2 -3
View File
@@ -719,9 +719,8 @@ impl Fs for RealFs {
{
Ok(metadata) => metadata,
Err(err) => {
return match (err.kind(), err.raw_os_error()) {
(io::ErrorKind::NotFound, _) => Ok(None),
(io::ErrorKind::Other, Some(libc::ENOTDIR)) => Ok(None),
return match err.kind() {
io::ErrorKind::NotFound | io::ErrorKind::NotADirectory => Ok(None),
_ => Err(anyhow::Error::new(err)),
};
}