7.1.x FIX: Rank URL mapping specificity by literal token count before wildcard captures - #15645
Merged
codeconsole merged 3 commits intoMay 18, 2026
Merged
Conversation
Contributor
|
@codeconsole looks like this broke some tests. if you can fix them, I'm happy to follow-up with a review. |
The /** catch-all pattern tokenizes to a single bare ** token (not (**))
because configureUrlPattern only rewrites (*)**. That made literalTokenCount
count ** as a literal, ranking /** above /$controller/$action?/$id? and
breaking DoubleWildcardUrlMappingTests.testDoubleWildcardWithMatchingController.
Switch the predicate to !t.contains('*'), which correctly treats any token
holding a wildcard char as non-literal.
🚨 TestLens detected 1 failed tests 🚨Here is what you can do:
Test Summary
🏷️ Commit: 3804600 Test FailureUserControllerSpec > User list (:grails-test-examples-scaffolding:integrationTest in CI / Functional Tests (Java 21, indy=false))Muted TestsNote Checks are currently running using the configuration below. Select tests to mute in this pull request: 🔲 UserControllerSpec > User list Reuse successful test results: 🔲 ♻️ Only rerun the tests that failed or were muted before Click the checkbox to trigger a rerun: 🔲 Rerun jobs Learn more about TestLens at testlens.app. |
codeconsole
requested review from
jamesfredley,
jdaugherty,
matrei and
sbglasius
and removed request for
matrei
May 15, 2026 16:13
jdaugherty
approved these changes
May 17, 2026
sbglasius
approved these changes
May 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When wildcard validation is enabled, AbstractGrailsControllerUrlMappings now sorts validated wildcard matches first by literal URL-token count (more literals = more specific) and only then by non-routing capture count. Previously a generic pattern like /$id/$action/$imageId could win over a more specific route such as /list/$stage/$sort because both had the same wildcard-capture status, causing the wrong controller/action to be resolved regardless of declaration order. Adds two WildcardActionValidationSpec cases covering both declaration orders.
#15525
#15542