diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2019-02-19 23:37:16 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2019-02-20 12:31:37 +0100 |
commit | 37bf2ce191636e0e962694290b8ea8e87f23cb8e (patch) | |
tree | cba40d6ef8be92e06e4115bcc6a7e8d186ad822e /lib/core | |
parent | ed862db76ffe3311eb534d69a6eb99ff63fdeb5a (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.rs | 11 |
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)) } |