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>
This commit is contained in:
Matthias Beyer 2019-02-19 23:37:16 +01:00
parent ed862db76f
commit 37bf2ce191

View file

@ -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 /// Revisit whether this can be done in a cleaner way. See commit message for why this is
/// needed. /// needed.
pub fn into_storeid_iter(self) -> StoreIdIterator { 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 let iter = self.0
.into_inner() .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)) StoreIdIterator::new(Box::new(iter))
} }