Fix libimagentrylink for new StoreId API
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
parent
642702b724
commit
429ef9bc4c
1 changed files with 17 additions and 17 deletions
|
@ -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,25 +435,25 @@ 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()
|
||||
.and_then(|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));
|
||||
rewrite_links(link.get_header_mut(), links)
|
||||
})
|
||||
.and_then(|_| {
|
||||
let _ = rewrite_links(link.get_header_mut(), links)?;
|
||||
|
||||
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)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
fn unlink(&mut self, store: &Store) -> Result<()> {
|
||||
|
@ -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"))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue