diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/groovy/GroovyMarkupConfigurer.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/groovy/GroovyMarkupConfigurer.java index 8d62b7264c7..df3932e05d6 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/groovy/GroovyMarkupConfigurer.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/groovy/GroovyMarkupConfigurer.java @@ -35,6 +35,7 @@ import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.core.io.Resource; import org.springframework.util.Assert; import org.springframework.util.StringUtils; +import org.springframework.web.servlet.resource.ResourceHandlerUtils; /** * An extension of Groovy's {@link groovy.text.markup.TemplateConfiguration} and @@ -223,7 +224,11 @@ public class GroovyMarkupConfigurer extends TemplateConfiguration @Override public URL resolveTemplate(String templatePath) throws IOException { Assert.state(this.classLoader != null, "No template ClassLoader available"); - return GroovyMarkupConfigurer.this.resolveTemplate(this.classLoader, templatePath); + String path = ResourceHandlerUtils.normalizeInputPath(templatePath); + if (ResourceHandlerUtils.shouldIgnoreInputPath(path)) { + throw new IOException("Invalid template path:" + templatePath); + } + return GroovyMarkupConfigurer.this.resolveTemplate(this.classLoader, path); } }