Skip to content

Conversation

@codeconsole
Copy link
Contributor

Follow up to #15213

"/$controller/$action?/$id?(.$format)?"

resulted in /user.json not matching. only /user would match. This fixes that.

Is seems like the best pathway forward to support formats and string $id's with .'s is the following mapping:

  // First: greedy with format constraint                                                                                              
  "/$controller/$action/$id+(.$format)?" {                                                                                             
      constraints {                                                                                                                    
          format(inList: ['json', 'xml', 'html', 'csv'])                                                                               
      }                                                                                                                                
  }                                                                                                                                    
  // Second: fallback for IDs with dots but no valid format                                                                            
  "/$controller/$action/$id"()  
URL id format Which mapping?
/user/show/bob.smith bob.smith null Fallback (no valid format)
/user/show/bob.smith.json bob.smith json Greedy (valid format)
/user/show/bob.smith.jones bob.smith.jones null Fallback (no valid format)
/user/show/bob.smith.jones.xml bob.smith.jones xml Greedy (valid format)

@github-actions github-actions bot added the bug label Jan 28, 2026
@codeconsole codeconsole changed the base branch from 7.0.x to 7.1.x January 28, 2026 00:51
@codeconsole codeconsole force-pushed the 7.1.x-url-mapping-greedy-extension-2 branch from bef4996 to d11867d Compare January 28, 2026 01:13
@codeconsole codeconsole merged commit ae0e16b into apache:7.1.x Jan 28, 2026
35 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants