Skip to content

Link URL Expressions Bug #40

@tao1991123

Description

@tao1991123

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.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions