Skip to content

Commit

Permalink
[fix] ensure yupiik.batch.frontend.extensionsJs is respected properly…
Browse files Browse the repository at this point in the history
… in frontend ui
  • Loading branch information
rmannibucau committed Jul 15, 2022
1 parent 90e945e commit c642eb2
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ public void doGet(final HttpServletRequest servletRequest, final HttpServletResp
private byte[] rewrite(final String indexHtml) {
final var js = configuration.getFrontendExtensionsJs();
if (js != null && !js.isBlank()) {
final int start = indexHtml.indexOf("<script src=\"/static/js/main.");
final int start = indexHtml.indexOf("<script defer=\"defer\" src=\"/static/js/main.");
if (start < 0) {
throw new IllegalArgumentException("Unexpected html");
}
return (indexHtml.substring(0, start) +
"<script src=\"" + js + "\"></script>" +
"<script defer=\"defer\" src=\"" + js + "\"></script>" +
indexHtml.substring(start)).getBytes(StandardCharsets.UTF_8);
}
return indexHtml.getBytes(StandardCharsets.UTF_8);
Expand Down

0 comments on commit c642eb2

Please sign in to comment.