Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-7277

TemplateResource.parse handles paths containing multiple dots incorrectly

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.9
    • Fix Version/s: 2.3.10, 2.4.1
    • Component/s: Templating
    • Labels:
      None

      Description

      When TemplateResource.parse is passed a path that contains multiple dots the resulting resource drops the second dot and everything that follows it from the path. For example: foo.html.tpl becomes foo.html. This truncation is the cause of this bug in Spring Boot: https://github.com/spring-projects/spring-boot/issues/2212

      I believe the problem can be solved by updating the regex declared in MarkupTemplateEngine to anchor the final group to the end of the string, i.e. I believe it could be a one character fix to add a $ to the end of the pattern:

      (.+?)(?:_([a-z]{2}(?:_[A-Z]{2,3})))?\\.(\\p{Alnum}+)$
      

        Attachments

          Activity

            People

            • Assignee:
              melix C├ędric Champeau
              Reporter:
              awilkinson Andy Wilkinson
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: