Allow bundled files to be downloaded by respecting a[download]

Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
This commit is contained in:
Eric Peterson
2021-05-26 17:07:45 +02:00
parent 5a54510cf7
commit 54d3fdb338
2 changed files with 8 additions and 0 deletions
@@ -37,6 +37,7 @@ const fixture = `
<body>
<img src="test.jpg" />
<script type="javascript" src="script.js"></script>
<a href="afile.pdf" download>Download Now</a>
</body>
</html>
`;
@@ -78,5 +79,11 @@ describe('addBaseUrl', () => {
mockEntityId,
'',
);
expect(techdocsStorageApi.getBaseUrl).toHaveBeenNthCalledWith(
4,
'afile.pdf',
mockEntityId,
'',
);
});
});
@@ -48,6 +48,7 @@ export const addBaseUrl = ({
updateDom<HTMLImageElement>(dom.querySelectorAll('img'), 'src');
updateDom<HTMLScriptElement>(dom.querySelectorAll('script'), 'src');
updateDom<HTMLLinkElement>(dom.querySelectorAll('link'), 'href');
updateDom<HTMLAnchorElement>(dom.querySelectorAll('a[download]'), 'href');
return dom;
};