thymeleaf / thymeleaf-spring

Thymeleaf integration module for Spring
http://www.thymeleaf.org
Apache License 2.0
435 stars 157 forks source link

Fragment is not proberly rendered if fragment name contains "." #329

Open sascha08-15 opened 4 weeks ago

sascha08-15 commented 4 weeks ago

For BUGS:

Expected behavior (option 1): Fragments of arbitrary names (including a ".") are rendered correctly. One gets the body rendered and a 200 OK.

Expected behavior (option 2): Fragment names including a "." are not supported. I'd expect an error message then and not a 200 OK.

Actual behaviour: I get a 200 OK response if the fragment is stored correctly and it is also found; however, it is never really returned, instead I get an empty reponse body.

I managed to trace the issue to the occurance of a "." in the fragment name.

Please provide the maximum detail possible. We will specifically need:

1) Create a controller

   @GetMapping("/test")
   public String test(final Model model)  {
      return "TestEntity-two :: testEntity.oneTwo";
   }

2) In your template TestEntity-two.html, put a fragement:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="https://www.thymeleaf.org" >
<head>
    <title>TestEntity</title>
</head>
<body>
    <div th:fragment="testEntity.oneTwo" id="testEntity">
        Renders OK
    </div>
</body>
</html>

Omitting the "." in the fragment name works