From 861ec83e93db55a72855f276bb2162f62c33e550 Mon Sep 17 00:00:00 2001 From: Ariel Davis Date: Mon, 26 Feb 2024 21:33:21 -0800 Subject: [PATCH] Return err if not exist in memory fs for canonical --- crates/paths/src/lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/paths/src/lib.rs b/crates/paths/src/lib.rs index 35ac62f..8480f4c 100644 --- a/crates/paths/src/lib.rs +++ b/crates/paths/src/lib.rs @@ -257,7 +257,11 @@ impl FileSystem for MemoryFileSystem { } fn canonical(&self, path: &Path) -> std::io::Result { - Ok(CanonicalPathBuf(path.to_owned())) + if self.inner.contains_key(path) { + Ok(CanonicalPathBuf(path.to_owned())) + } else { + Err(std::io::Error::from(std::io::ErrorKind::NotFound)) + } } }