Skip to content

Commit baa216c

Browse files
committed
fix for GRAILS-6078 "Plugins that use pluginContextPath explicitly don't work in 1.2.x due to duplication of pluginContextPath"
1 parent 00d50ba commit baa216c

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/java/org/codehaus/groovy/grails/plugins/web/taglib/RenderTagLib.groovy

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -472,19 +472,23 @@ class RenderTagLib implements com.opensymphony.module.sitemesh.RequestConstants
472472
def engine = groovyPagesTemplateEngine
473473
def uri = grailsAttributes.getTemplateUri(attrs.template,request)
474474
def var = attrs['var']
475-
def contextPath = attrs.contextPath ? attrs.contextPath : null
476-
477-
if(attrs.plugin) {
478-
contextPath = pluginManager?.getPluginPath(attrs.plugin) ?: ''
479-
}
480-
else if (contextPath == null) {
481-
contextPath = pageScope.pluginContextPath ?: ""
482-
}
483475

484476
Template t = TEMPLATE_CACHE[uri]
485477

486-
def templatePath = "${contextPath}${uri}"
487478
if(t==null) {
479+
def contextPath = attrs.contextPath ? attrs.contextPath : null
480+
481+
if(attrs.plugin) {
482+
contextPath = pluginManager?.getPluginPath(attrs.plugin) ?: ''
483+
}
484+
else if (contextPath == null) {
485+
if(uri.startsWith("/plugins/")) contextPath = ""
486+
else {
487+
contextPath = pageScope.pluginContextPath ?: ""
488+
}
489+
}
490+
def templatePath = "${contextPath}${uri}"
491+
488492
t = engine.createTemplateForUri([templatePath, "${contextPath}/grails-app/views/${uri}"] as String[])
489493
if(!engine.isReloadEnabled() && t!=null) {
490494
def prevt = TEMPLATE_CACHE.putIfAbsent(uri, t)

0 commit comments

Comments
 (0)