Skip to content

Commit cc6fbc3

Browse files
committed
fix failing test
1 parent cc2f2ed commit cc6fbc3

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,19 @@ 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+
if(!controller.getClass().getSimpleName().endsWith(ControllerArtefactHandler.TYPE)) {
84+
GrailsWebRequest webRequest = GrailsWebRequest.lookup();
85+
return webRequest != null ? webRequest.getControllerName() : null;
86+
}
87+
else {
88+
return GrailsNameUtils.getLogicalPropertyName(controller.getClass().getSimpleName(), ControllerArtefactHandler.TYPE);
89+
}
90+
}
8591
}
8692

8793
/**

0 commit comments

Comments
 (0)