summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Beyer <matthias.beyer@atos.net>2021-01-25 11:57:08 +0100
committerMatthias Beyer <matthias.beyer@atos.net>2021-01-25 11:58:25 +0100
commit4e5a8ae7d469e723cc1806566442c59536343efc (patch)
tree2f9f867ebca059a52db363eb49226256b0881f53 /src
parentb702755720137b9b844c6580dfae9f2bd4c3fb83 (diff)
Fix: Filter each entry, strip prefix
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
Diffstat (limited to 'src')
-rw-r--r--src/filestore/path.rs17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/filestore/path.rs b/src/filestore/path.rs
index 9ddc989..ab0655b 100644
--- a/src/filestore/path.rs
+++ b/src/filestore/path.rs
@@ -17,6 +17,7 @@ use anyhow::Context;
use anyhow::Error;
use anyhow::Result;
use resiter::AndThen;
+use resiter::Filter;
use resiter::Map;
#[derive(Clone, Debug, PartialEq, Eq)]
@@ -84,12 +85,24 @@ impl StoreRoot {
pub(in crate::filestore) fn find_artifacts_recursive(
&self,
) -> impl Iterator<Item = Result<ArtifactPath>> {
+ log::trace!("Loading artifacts from directory: {:?}", self.0);
+ let root = self.0.clone();
walkdir::WalkDir::new(&self.0)
.follow_links(false)
.into_iter()
- .filter_entry(|e| e.file_type().is_file())
+ .filter_ok(|e| {
+ let is_file = e.file_type().is_file();
+ log::trace!("{:?} is file = {}", e, is_file);
+ is_file
+ })
+ .inspect(|p| log::trace!("Loading Artifact from path: {:?}", p))
.map_err(Error::from)
- .map_ok(|de| de.into_path())
+ .and_then_ok(move |de| {
+ de.path()
+ .strip_prefix(&root)
+ .map(|p| p.to_path_buf())
+ .map_err(Error::from)
+ })
.and_then_ok(ArtifactPath::new)
}