MediaType.parseMediaTypes fails if the input contains a comma [SPR-17459] #21991
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: enhancement
A general enhancement
Milestone
Fabian Kürten opened SPR-17459 and commented
For the class
org.springframework.http.MediaType
Parsing a list of media types fails if a media type contains a comma ",".
For example this fails with InvalidMediaTypeException:
While the comma is the separator for different media types in a header my understanding is that it is legal to use
tspecial
characters (like comma) inside a quoted string.However the implementation of
parseMediaTypes
tokenizes blindly by comma, ignoring quotes. The resulting parts are invalid media types (ends with an open quote) which leads to the exception.Affects: 5.0.4, 5.1.2
Referenced from: commits f4b05dc, 7bbd4c6, ba3fef3
The text was updated successfully, but these errors were encountered: