From 6aa6154d9f8dfb26da5dd662f021d9dde9b5814c Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 7 Dec 2020 13:31:39 +0100 Subject: Fix: ArtifactPath::is_dir() should not exist This removes the ArtifactPath::is_dir() function, which should not exist because we try to guarantee that ArtifactPath is relative, so this function would always return false results. Signed-off-by: Matthias Beyer --- src/filestore/artifact.rs | 2 +- src/filestore/path.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/filestore') diff --git a/src/filestore/artifact.rs b/src/filestore/artifact.rs index 38db774..390bc7d 100644 --- a/src/filestore/artifact.rs +++ b/src/filestore/artifact.rs @@ -49,7 +49,7 @@ impl Artifact { version }) } else { - if path.is_dir() { + if root.join(&path).is_dir() { Err(anyhow!("Cannot load non-file path: {}", path.display())) } else { Err(anyhow!("Path does not exist: {}", path.display())) diff --git a/src/filestore/path.rs b/src/filestore/path.rs index 9b60401..b2f677b 100644 --- a/src/filestore/path.rs +++ b/src/filestore/path.rs @@ -87,10 +87,6 @@ impl ArtifactPath { pub (in crate::filestore) fn file_stem(&self) -> Option<&OsStr> { self.0.file_stem() } - - pub (in crate::filestore) fn is_dir(&self) -> bool { - self.0.is_dir() - } } #[derive(Clone, Debug, PartialEq, Eq)] @@ -105,6 +101,10 @@ impl<'a> FullArtifactPath<'a> { self.joined().is_file() } + pub (in crate::filestore) fn is_dir(&self) -> bool { + self.joined().is_dir() + } + pub fn display(&self) -> FullArtifactPathDisplay<'a> { FullArtifactPathDisplay(self.0, self.1) } -- cgit v1.2.3