Skip to content

File upload with Servlet 3 multipart requests should support filename with charset encoding (RFC 2231) [SPR-13319] #17904

Closed
@spring-projects-issues

Description

@spring-projects-issues

Andy Goossens opened SPR-13319 and commented

We have a Django/Python application that tries to upload a file to a Spring web application. This fails for non-latin file names as Spring Framework does not support the Content-Disposition header it is receiving. It looks something like this:

Content-Disposition: form-data; name="file"; filename*=UTF-8''foo-%c3%a4-%e2%82%ac.html

This should result in a file called foo-ä-€.html.

I cannot blame the Python app as it is following RFC 2231. The method StandardMultipartHttpServletRequest.extractFilename(String contentDisposition) has a TODO comment that seems to refer to its incapability to handle such cases:

// TODO: can only handle the typical case at the moment

This site has a nice overview of possible Content-Disposition values and how browsers cope with them: http://greenbytes.de/tech/tc2231/ But note that this page describes download actions and not uploads.


Affects: 4.1.7

Issue Links:

Referenced from: commits 1a9e42b

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions