-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Labels
Description
Code
const { TemplateEngine, STANDARD_CONFIGURATION } = require("thymeleaf");
const templateEngine = new TemplateEngine(STANDARD_CONFIGURATION);
(async () => {
const content1 =
'<script type="text/javascript" th:src="@{//www.testcdn.com/test/{version}/index.js(version=${version})}"></script>';
const content2 =
'<script type="text/javascript" th:src="@{//www.testcdn.com/test/{version}/index.js(version=${version}, cdn=${cdn})}"></script>';
const content3 =
'<script type="text/javascript" th:src="@{//www.testcdn.com/test/{version}/{version}/index.js(version=${version})}"></script>';
const content4 =
'<script type="text/javascript" th:src="@{//{cdn}/test/{version}/index.js(cdn=${cdn}, version=${version})}"></script>';
const content5 =
'<script type="text/javascript" th:src="@{//www.testcdn.com/test/{VERSION}/index.js(version=${version})}"></script>';
const html = await templateEngine.process(content1, {
cdn: "www.testcdn.com",
version: "2.0.0",
});
console.log("html", html);
})();in Java, all cases are rendered successfully
content1
render successfully
<html><head><script type="text/javascript" src="//www.testcdn.com/test/2.0.0/index.js"></script></head><body></body></html>content 2
there is a space character between 'index.js?' and 'cdn='。
<html><head><script type="text/javascript" src="//www.testcdn.com/test/2.0.0/index.js? cdn=www.testcdn.com"></script></head><body></body></html>content 3 & content 4
render fail, it will be in a infinite loop.
content 5
render fail, it should throw a error rather than fall in a infinite loop.