summaryrefslogtreecommitdiffstats
path: root/src/filestore
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2020-12-07 13:31:39 +0100
committerMatthias Beyer <mail@beyermatthias.de>2020-12-07 13:31:39 +0100
commit6aa6154d9f8dfb26da5dd662f021d9dde9b5814c (patch)
tree8910334bcc67fe0974ecbd2a4c329074a0df7f2b /src/filestore
parentffe7559bb93b8ca704fa8f65c4eba3233e8f62b8 (diff)
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 <mail@beyermatthias.de>
Diffstat (limited to 'src/filestore')
-rw-r--r--src/filestore/artifact.rs2
-rw-r--r--src/filestore/path.rs8
2 files changed, 5 insertions, 5 deletions
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)
}