reports: URL-quote file links in spreadsheets. RT#12517
This was already done correctly in RT links because rtutil takes care of the quoting. The fact that we weren't doing it for file links was an oversight.
This commit is contained in:
parent
de10197af7
commit
c2851f5cc0
2 changed files with 6 additions and 1 deletions
|
@ -1172,7 +1172,7 @@ class BaseODS(BaseSpreadsheet[RT, ST], metaclass=abc.ABCMeta):
|
|||
# '..' pops the ODS filename off the link path. In other words,
|
||||
# make the link relative to the directory the ODS is in.
|
||||
href_path = Path('..', href)
|
||||
href = str(href_path)
|
||||
href = urlparse.quote(str(href_path))
|
||||
text = href_path.name
|
||||
else:
|
||||
rt_path = urlparse.urlparse(rt_href).path
|
||||
|
|
|
@ -617,6 +617,7 @@ def test_ods_writer_meta_links_cell(ods_writer):
|
|||
'rt://ticket/2/attachments/9',
|
||||
'rt:1/5',
|
||||
'Invoices/0123.pdf',
|
||||
'Invoice #789.pdf',
|
||||
]
|
||||
cell = ods_writer.meta_links_cell(meta_links, stylename='meta1')
|
||||
assert cell.getAttribute('valuetype') == 'string'
|
||||
|
@ -642,6 +643,10 @@ def test_ods_writer_meta_links_cell(ods_writer):
|
|||
expect_url = f'../{meta_links[3]}'
|
||||
assert child.getAttribute('href') == expect_url
|
||||
assert get_text(child) == '0123.pdf'
|
||||
child = next(children)
|
||||
assert child.getAttribute('type') == 'simple'
|
||||
assert child.getAttribute('href') == '../Invoice%20%23789.pdf'
|
||||
assert get_text(child) == 'Invoice #789.pdf'
|
||||
|
||||
def test_ods_writer_multiline_cell(ods_writer):
|
||||
cell = ods_writer.multiline_cell(iter(STRING_CELL_DATA))
|
||||
|
|
Loading…
Reference in a new issue