Chrome not recognising attachment filename

We have a web application which offers a file named L_2804071.key for download. The download works fine in Internet Explorer and FireFox but in Chrome it "loses" the filename and chrome does not seem to recognize the filename in the content-disposition header.

Here is the full header (identical in both browsers):

content-disposition: attachment; =?utf-16le?B?ZmlsZW5hbWU9TF8yODA0MDcxLmtleQ==?=

I don't know if this helps but if you decode =?utf-16le?B?ZmlsZW5hbWU9TF8yODA0MDcxLmtleQ==?= you get Wfilename=L_2804071.key which looks weird. Not sure where the "W" comes from but IE seems to work with it and downloads a file named L_2804071.key .


Fix the web application to return a Content-Disposition header field that follows the spec, your example is invalid (for starters, there's no "filename" parameter). Note that your example appears to use RFC2047-style encoding, which in general isn't used in Content-Disposition.

See http://greenbytes.de/tech/webdav/rfc6266.html for details.

链接地址: http://www.djcxy.com/p/46828.html

上一篇: 从NodeJS服务器下载文件添加标头以进行内容处置

下一篇: Chrome无法识别附件文件名