Skip to content

UriComponents should support URI variables that contain a regex [SPR-13311] #17896

@spring-projects-issues

Description

@spring-projects-issues

nbank opened SPR-13311 and commented

In org.springframework.web.util.UriComponents#NAMES_PATTERN the following Pattern is used: {([^/]+?)}

If you use Path-Variables like myurl/{name:[a-z]{1,5}}/show so accept only 5 lower case letters, then the UriCompents work wrong, because it will expand for name=test to myurl/test}/show which is wrong.

One Workaround is to cleanup the url before with

url.replaceAll("\\{([A-Za-z0-9_-]+?):([^{}]+?\\{[0-9,]+?\\})*([^{}]+)*\\}", "{$1}");

Affects: 4.1.7

Issue Links:

Referenced from: commits 2e79a30

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions