-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Description
Oliver Becker opened SPR-16414 and commented
We just encountered an error in our Spring Boot application that came from the innocent looking call
ServletUriComponentsBuilder.fromRequest(httpServletRequest)
which uses internally
ServletServerHttpRequest.getURI()
The URL of this request was indeed illegal since it had an illegal escape sequence in its query part, something like http://app.org/request?query=foo%
or http://app.org/request?query=foo%xx
. Typing this URL into a browser will cause normal request processing (the controller will handle the query
parameter as not present, the corresponding @RequestParam
is null), however using the ServletUriComponentsBuilder
as mentioned above will cause a java.net.URISyntaxException
. (In our case this exception occurred during the rendering of the view, which is even worse.)
I wonder if the framework (i.e. ServletUriComponentsBuilder
or ServletUriComponentsBuilder
) should handle this illegal URI. Or is it the job of the application using the framework? Either way, the user shouldn't see an error 500.
Affects: 4.3.13
Referenced from: commits 0e6f8df, 04f9549
Backported to: 4.3.15