Skip to content

Commit b27ad24

Browse files
committed
Merge branch '3.0.x'
2 parents fd6d981 + 03ff4cf commit b27ad24

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

grails-web-common/src/main/groovy/org/grails/web/pages/GroovyPagesUriSupport.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,20 @@ public String getNoSuffixViewURI(GroovyObject controller, String viewName) {
7575
}
7676

7777
public String getLogicalControllerName(GroovyObject controller) {
78-
if(controller != null) {
79-
return GrailsNameUtils.getLogicalPropertyName(controller.getClass().getSimpleName(), ControllerArtefactHandler.TYPE);
80-
}
81-
else {
78+
if(controller == null) {
8279
GrailsWebRequest webRequest = GrailsWebRequest.lookup();
8380
return webRequest != null ? webRequest.getControllerName() : null;
8481
}
82+
else {
83+
String simpleName = controller.getClass().getSimpleName();
84+
if(!simpleName.endsWith(ControllerArtefactHandler.TYPE)) {
85+
GrailsWebRequest webRequest = GrailsWebRequest.lookup();
86+
return webRequest != null ? webRequest.getControllerName() : null;
87+
}
88+
else {
89+
return GrailsNameUtils.getLogicalPropertyName(simpleName, ControllerArtefactHandler.TYPE);
90+
}
91+
}
8592
}
8693

8794
/**

0 commit comments

Comments
 (0)