Skip to content

Support encoded Content-Disposition fields

Stan Hu requested to merge sh-support-encoded-content-disposition into master

https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/24919/diffs adds support for Rails sending the right Content-Disposition header when there are non-ASCII filenames (e.g. テスト.txt). That example file would render the following Content-Disposition:

attachment; filename="テスト.txt", filename*=UTF-8''%E3%83%86%E3%82%B9%E3%83%88.txt

Since mime.ParseMediaType appears to strip this header to a canonical filename, it's not possible to use this to generate the right Content-Disposition. Instead, we can preserve the existing Content-Disposition and convert types just by doing a search and replace (i.e. change attachment to inline and vice versa when necessary).

Closes #207 (closed)

Edited by Stan Hu

Merge request reports