diff --git a/conservancy_beancount/reports/accrual.py b/conservancy_beancount/reports/accrual.py index 404ce31c5521d1a3743fb52c3c96caa23fb01c8c..5713fee19619acb76cce89a5d70a6b64e452d076 100644 --- a/conservancy_beancount/reports/accrual.py +++ b/conservancy_beancount/reports/accrual.py @@ -390,20 +390,16 @@ class AgingODS(core.BaseODS[AccrualPostings, Optional[data.Account]]): def _link_seq(self, row: AccrualPostings, key: MetaKey) -> Iterator[Tuple[str, str]]: for href in row.all_meta_links(key): - text: Optional[str] = None rt_ids = self.rt_wrapper.parse(href) - if rt_ids is not None: - ticket_id, attachment_id = rt_ids - if attachment_id is None: - text = f'RT#{ticket_id}' - href = self.rt_wrapper.url(ticket_id, attachment_id) or href - else: + rt_href = rt_ids and self.rt_wrapper.url(*rt_ids) + if rt_ids is None or rt_href is None: # '..' pops the ODS filename off the link path. In other words, # make the link relative to the directory the ODS is in. - href = f'../{href}' - if text is None: - href_path = Path(urlparse.urlparse(href).path) + href_path = Path('..', urlparse.urlparse(href).path) + href = str(href_path) text = urlparse.unquote(href_path.name) + else: + text = self.rt_wrapper.unparse(*rt_ids) yield (href, text) def write_row(self, row: AccrualPostings) -> None: