groovyzk/grailszk

Urlmappings not working as expected for mapping entry "/$controller/$action?/$id?(.$format)?"

asmbit opened this issue · 3 comments

asmbit commented

Settings in Urlmappings like this are ignored:

        "/$controller/$action?/$id?(.$format)?" {
            constraints {
                // apply constraints here
				controller inList: ['test']
            }
        }

Also commenting out the complete entry is ignored.

Hello, @asmbit. Can you write the steps for me to reproduce the bug? What is the successful case? What is the current behavior?

I suppose you tested with the example project. Right?

asmbit commented

Hello @maiconandsilva, thanks for great helpfulness.

To reproduce the bug you can start from the example project and modify "UrlMappings.groovy" to

package file.upload

class UrlMappings {

    static mappings = {
        "/$controller/$action?/$id?(.$format)?"{
            constraints {
                controller(notEqual: "test")
            }
        }

        "/admin/test/$action?/$id?(.$format)?"(controller:'test') {
            constraints {
            }
        }

        "500"(view:'/error')
        "404"(view:'/notFound')
    }
}

The test controller is reachable trough "http://localhost:8085/admin/test/index". Instead "http://localhost:8085/test/index" should produce 404. That's not the case. Both URLs produce the same output. Same if you change "UrlMappings.groovy" to:

package file.upload

class UrlMappings {

        "/admin/test/$action?/$id?(.$format)?"(controller:'test') {
            constraints {
            }
        }

        "500"(view:'/error')
        "404"(view:'/notFound')
    }
}

@asmbit, alright. I'll take a look into it as soon as possible. I'll let you know about my progress.