From 37bf2ce191636e0e962694290b8ea8e87f23cb8e Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 19 Feb 2019 23:37:16 +0100 Subject: [PATCH] Fix: Use StoreIdWithBase::from_full_path We iterate over full pathes to store entries here, which causes `StoreId::new()` to error. But if we use the internal parsing helper `StoreIdWithBase::from_full_path()` and then call `::into_storeid()` on the resulting object, everything is fine. Signed-off-by: Matthias Beyer --- lib/core/libimagstore/src/iter.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/core/libimagstore/src/iter.rs b/lib/core/libimagstore/src/iter.rs index 2e895b78..1aba5a58 100644 --- a/lib/core/libimagstore/src/iter.rs +++ b/lib/core/libimagstore/src/iter.rs @@ -186,9 +186,18 @@ impl<'a> Entries<'a> { /// Revisit whether this can be done in a cleaner way. See commit message for why this is /// needed. pub fn into_storeid_iter(self) -> StoreIdIterator { + use storeid::StoreIdWithBase; + use storeid::IntoStoreId; + + let storepath = self.1.path().to_path_buf(); + let iter = self.0 .into_inner() - .map(|r| r.and_then(StoreId::new)); + .map(move |r| { + r.and_then(|path| { + StoreIdWithBase::from_full_path(&storepath, path)?.into_storeid() + }) + }); StoreIdIterator::new(Box::new(iter)) }