apache / apache/grails-core

match/exclude in interceptors don't correctly read the controllername when having hyphenated url converter

Open
#11,165 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

### Steps to Reproduce

1. open LogEnvController index action

### Expected Behaviour
In Grails when you refer to controller names, you use non-hyphenated references. For example with the createLink taglib or in URLMappings.

### Actual Behaviour
But Interceptors match only work if you match with the hyphenated uri reference of the controller name.
When I see in the code (org.grails.plugins.web.interceptors.UrlMappingMatcher) it only seem to run the match against the request uri.

So in conclusion:
match(controller: "logEnvSwitch", action: "*") does not work
match(controller: "log-env-switch", action: "*") work

Consistent behavior would be support for both?

### Environment Information

- **Operating System**: Ubuntu 18.04 64bits
- **Grails Version:** 3.3.8
- **JDK Version:** OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-1ubuntu0.18.04.1-b13)

### Example Application

https://github.com/olavgg/hyphenatedinterceptorbug

Contributor guide

Open the contributing guide

Research direction

Start with org.grails.plugins.web.interceptors.UrlMappingMatcher and reproduce the behavior in the linked hyphenatedinterceptorbug example application by opening LogEnvController's index action. Done means interceptor matching accepts the non-hyphenated controller name as well as the hyphenated URI reference.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.