ContentDisposition cannot parse encoded filename with leading space #24112
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
status: backported
An issue that has been backported to maintenance branches
type: enhancement
A general enhancement
Milestone
Affects:
The Content-Disposition parser supports filename encoding.
However, if there is a space in front of the encoding, it fails with an
IllegalCharsetNameException
:Note the two spaces in front of the 'UTF-8'. One is from the exception string template, the other is from the parsed value from the response header.
We have an application running on the Undertow webserver. The exact header from an example response looks like this:
Content-Disposition: attachment; filename*= UTF-8''some-file.zip
This is a valid header format as per RFC 6266 Section 5 (Examples) where the following example is listed:
My suggested fix is to
trim()
the charset before passing it to Java.The text was updated successfully, but these errors were encountered: