summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2018-12-13 01:28:01 +0100
committerMatthias Beyer <mail@beyermatthias.de>2019-02-15 20:53:29 +0100
commit429ef9bc4c1ff6bd16188b251a59b95a5beea949 (patch)
tree70097e5ad4034faf5a5f7a181ff89b450887f8c5 /lib
parent642702b724e365ae67974bf4a0387dd54948f6e9 (diff)
Fix libimagentrylink for new StoreId API
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/entry/libimagentrylink/src/internal.rs34
1 files changed, 17 insertions, 17 deletions
diff --git a/lib/entry/libimagentrylink/src/internal.rs b/lib/entry/libimagentrylink/src/internal.rs
index 7b092d24..65277095 100644
--- a/lib/entry/libimagentrylink/src/internal.rs
+++ b/lib/entry/libimagentrylink/src/internal.rs
@@ -80,9 +80,9 @@ impl Link {
/// Helper wrapper around Link for StoreId
fn without_base(self) -> Link {
match self {
- Link::Id { link: s } => Link::Id { link: s.without_base() },
+ Link::Id { link: s } => Link::Id { link: s },
Link::Annotated { link: s, annotation: ann } =>
- Link::Annotated { link: s.without_base(), annotation: ann },
+ Link::Annotated { link: s, annotation: ann },
}
}
@@ -435,24 +435,24 @@ impl InternalLinker for Entry {
fn remove_internal_link(&mut self, link: &mut Entry) -> Result<()> {
debug!("Removing internal link: {:?}", link);
- let own_loc = self.get_location().clone().without_base();
- let other_loc = link.get_location().clone().without_base();
+
+ // Cloning because of borrowing
+ let own_loc = self.get_location().clone();
+ let other_loc = link.get_location().clone();
debug!("Removing internal link from {:?} to {:?}", own_loc, other_loc);
- link.get_internal_links()
+ let links = link.get_internal_links()?;
+ debug!("Rewriting own links for {:?}, without {:?}", other_loc, own_loc);
+
+ let links = links.filter(|l| !l.eq_store_id(&own_loc));
+ let _ = rewrite_links(link.get_header_mut(), links)?;
+
+ self.get_internal_links()
.and_then(|links| {
- debug!("Rewriting own links for {:?}, without {:?}", other_loc, own_loc);
- let links = links.filter(|l| !l.eq_store_id(&own_loc));
- rewrite_links(link.get_header_mut(), links)
- })
- .and_then(|_| {
- self.get_internal_links()
- .and_then(|links| {
- debug!("Rewriting own links for {:?}, without {:?}", own_loc, other_loc);
- let links = links.filter(|l| !l.eq_store_id(&other_loc));
- rewrite_links(self.get_header_mut(), links)
- })
+ debug!("Rewriting own links for {:?}, without {:?}", own_loc, other_loc);
+ let links = links.filter(|l| !l.eq_store_id(&other_loc));
+ rewrite_links(self.get_header_mut(), links)
})
}
@@ -682,7 +682,7 @@ pub mod store_check {
if is_match!(self.get(id.clone()), Ok(Some(_))) {
debug!("Exists in store: {:?}", id);
- if !id.exists()? {
+ if !self.exists(id.clone())? {
warn!("Does exist in store but not on FS: {:?}", id);
return Err(err_msg("Link target does not exist"))
}