Skip to content

UrlMappings with group and collection produce error URL #10308

@todoubaba

Description

@todoubaba

Steps to Reproduce

  1. grails create-app test
  2. modify UrlMappings.groovy, add
      "/foos"(resources: 'foo') {
          collection {
              '/baz'(controller: 'foo', action: 'baz')
          }
      }

      group "/g", {
          "/bars"(resources: 'bar') {
              collection {
                  '/baz'(controller: 'bar', action: 'baz')
              }
          }
      }
  1. grails url-mapping-report

Expected Behaviour

Controller: bar
 |   GET    | /g/bars/create                                    | Action: create           |
 |   GET    | /g/bars/${id}/edit                                | Action: edit             |
 |    *     | /g/bars/${barId}/baz                              | Action: baz              | <---
 |   POST   | /g/bars                                           | Action: save             |
 |   GET    | /g/bars                                           | Action: index            |
 |  DELETE  | /g/bars/${id}                                     | Action: delete           |
 |  PATCH   | /g/bars/${id}                                     | Action: patch            |
 |   PUT    | /g/bars/${id}                                     | Action: update           |
 |   GET    | /g/bars/${id}                                     | Action: show             |

Controller: foo
 |   GET    | /foos/create                                      | Action: create           |
 |    *     | /foos/baz                                         | Action: baz              |
 |   GET    | /foos/${id}/edit                                  | Action: edit             |
 |   POST   | /foos                                             | Action: save             |
 |   GET    | /foos                                             | Action: index            |
 |  DELETE  | /foos/${id}                                       | Action: delete           |
 |  PATCH   | /foos/${id}                                       | Action: patch            |
 |   PUT    | /foos/${id}                                       | Action: update           |
 |   GET    | /foos/${id}                                       | Action: show             |

Actual Behaviour

Controller: bar
 |   GET    | /g/bars/create                                    | Action: create           |
 |   GET    | /g/bars/${id}/edit                                | Action: edit             |
 |    *     | /g/bars/baz                                       | Action: baz              | <---
 |   POST   | /g/bars                                           | Action: save             |
 |   GET    | /g/bars                                           | Action: index            |
 |  DELETE  | /g/bars/${id}                                     | Action: delete           |
 |  PATCH   | /g/bars/${id}                                     | Action: patch            |
 |   PUT    | /g/bars/${id}                                     | Action: update           |
 |   GET    | /g/bars/${id}                                     | Action: show             |

Controller: foo
 |   GET    | /foos/create                                      | Action: create           |
 |    *     | /foos/baz                                         | Action: baz              |
 |   GET    | /foos/${id}/edit                                  | Action: edit             |
 |   POST   | /foos                                             | Action: save             |
 |   GET    | /foos                                             | Action: index            |
 |  DELETE  | /foos/${id}                                       | Action: delete           |
 |  PATCH   | /foos/${id}                                       | Action: patch            |
 |   PUT    | /foos/${id}                                       | Action: update           |
 |   GET    | /foos/${id}                                       | Action: show             |

Environment Information

  • Operating System: Windows 10
  • Grails Version: 3.2.2
  • JDK Version: 1.8

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions