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:
+2
-3
@@ -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)),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user