Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
asmbit opened this issue Aug 24, 2023 · 3 comments
Assignees

Comments

@asmbit
Copy link

asmbit commented Aug 24, 2023

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.

@maiconandsilva
Copy link
Member

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
Copy link
Author

asmbit commented Aug 29, 2023

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')
    }
}

@maiconandsilva maiconandsilva self-assigned this Aug 29, 2023
@maiconandsilva
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants