summaryrefslogtreecommitdiffstats
path: root/lib/core
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2019-02-19 23:37:16 +0100
committerMatthias Beyer <mail@beyermatthias.de>2019-02-20 12:31:37 +0100
commit37bf2ce191636e0e962694290b8ea8e87f23cb8e (patch)
treecba40d6ef8be92e06e4115bcc6a7e8d186ad822e /lib/core
parented862db76ffe3311eb534d69a6eb99ff63fdeb5a (diff)
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 <mail@beyermatthias.de>
Diffstat (limited to 'lib/core')
-rw-r--r--lib/core/libimagstore/src/iter.rs11
1 files changed, 10 insertions, 1 deletions
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))
}