Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support BASE64 file name encoding in ContentDisposition #26463

Closed

Conversation

yusuke
Copy link
Contributor

@yusuke yusuke commented Jan 28, 2021

There are web servers encode Content-Disposition filename part using BASE64 like - filename="=?UTF-8?B?5pel5pys6KqeLmNzdg==?=" which translates to 日本語.csv.

But ContentDisposition.parse() is not aware of that format.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jan 28, 2021
@sbrannen sbrannen added in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement labels Jan 28, 2021
@sbrannen sbrannen changed the title ContentDisposition parser cannot parse encodings with BASE64 Support BASE64 file name encoding in ContentDisposition Jan 28, 2021
@rstoyanchev
Copy link
Contributor

RFC 6266, section 4.3 says "filename" or "filename*" where the latter is used for character sets other than ISO-8859-1. Is this base64 filename format based on any spec? If you are able to share it would help to know what server(s) emit this format.

@rstoyanchev rstoyanchev added the status: waiting-for-feedback We need additional information before we can continue label Jan 29, 2021
@yusuke
Copy link
Contributor Author

yusuke commented Jan 29, 2021

The web server I'm dealing is https://bizstn.bk.mufg.jp/
It's an online banking system and I get that header when I download the transaction details as in CSV format.
Below is the Content-Disposition header value of the actual response.

attachment; filename="=?UTF-8?B?TUVJU0FJMjAyMTAxMjkyMzAwMjYuY3N2?=";

Chrome browser decodes the response using BASE64 and recognizes it as MEISAI20210129230026.csv

The web server seems to be Apache, not sure what is running behind.
ScreenShot 2021-01-29 23 14 24

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Jan 29, 2021
@yusuke
Copy link
Contributor Author

yusuke commented Jan 30, 2021

The ?[charset]?B format appears to be defined by RFC2047 - 4.1. The "B" encoding
https://tools.ietf.org/html/rfc2047

@rstoyanchev rstoyanchev added this to the 5.3.4 milestone Feb 1, 2021
@rstoyanchev rstoyanchev self-assigned this Feb 1, 2021
@rstoyanchev
Copy link
Contributor

Thanks for the extra details. I'll have a look at this for 5.3.4. In the very least we can make sure that we can parse such headers correctly.

@rstoyanchev rstoyanchev removed status: feedback-provided Feedback has been provided status: waiting-for-triage An issue we've not yet triaged or decided on labels Feb 1, 2021
This was referenced Mar 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants