Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sascha08-15 opened this issue Nov 1, 2024 · 0 comments
Open

Comments

@sascha08-15
Copy link

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:

  • Version of Thymeleaf (and any involved extensions) you are using.
    3.1.2
  • Environment: versions of Spring, Spring Boot, or any other
    relevant libraries.
    Spring Boot 3.3.5
  • Detailed steps to reproduce your issue.
  1. Create a controller
   @GetMapping("/test")
   public String test(final Model model)  {
      return "TestEntity-two :: testEntity.oneTwo";
   }
  1. 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>
  • Any possible workarounds you may have found.

Omitting the "." in the fragment name works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant