Added code that was left out from last commit.

This commit is contained in:
CalDescent 2021-12-19 16:40:31 +00:00
parent cad25bf85d
commit ccf8773b18

View File

@ -93,11 +93,12 @@ public class ArbitraryDataRenderer {
if (HTMLParser.isHtmlFile(filename)) {
// HTML file - needs to be parsed
byte[] data = Files.readAllBytes(Paths.get(filePath)); // TODO: limit file size that can be read into memory
HTMLParser htmlParser = new HTMLParser(resourceId, inPath, prefix, usePrefix);
data = htmlParser.replaceRelativeLinks(filename, data);
HTMLParser htmlParser = new HTMLParser(resourceId, inPath, prefix, usePrefix, data);
htmlParser.injectJavascript();
htmlParser.replaceRelativeLinks(filename);
response.setContentType(context.getMimeType(filename));
response.setContentLength(data.length);
response.getOutputStream().write(data);
response.getOutputStream().write(htmlParser.getData());
}
else {
// Regular file - can be streamed directly