When there is a port, a query, or a fragment but there is no path in URI String, UriComponentsBuilder#fromUriString() will result in a bug.

Example: - with http://localhost:8080?foo=bar URI, after running UriComponentsBuilder#fromUriString(), the port will be 8080?foo=bar. - with http://localhost:8080#foo URI, after running UriComponentsBuilder#fromUriString(), the port will be 8080#foo.

It seems that this change #26905 affected UriComponentsBuilder#fromUriString().

Comment From: glqdlt

Hello, I am the author of #26905. Thank you for reporting the issue.

Comment From: glqdlt

I have fixed this issue and additional bugs in #26918. Thank you.

Comment From: izeye

This seems to have been resolved via https://github.com/spring-projects/spring-framework/commit/0468ef46ac33e33a6791ae9d05788c07548f0453 already.

Comment From: rstoyanchev

Yes indeed, thanks!