Skip to content

Revisit fix for gh-26905 in UriComponentsBuilder #27039

@bclozel

Description

@bclozel

The fix for gh-26905 introduced an unintended behavior change for some ambiguous URL patterns:

URI uri = UriComponentsBuilder
				.fromUriString("ws://localhost:{port}{path}")
				.buildAndExpand(7777, "/test")
				.toUri();

// Now fails because it's parsing "7777/test" as an integer port value.

While the fix for gh-26905 better warns against invalid port values, it now fails for ambiguous patterns and matches more than expected if a "/" is not present before variable expansion. We should refine the PORT_PATTERN and ensure that such use cases are still working.

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: regressionA bug that is also a regression

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions