Response.AsAttachment issue: cannot get response if set filename to Chinese text
Author: Summer006Created Nov 3, 2019Updated Mar 10, 2020
Prerequisites
- [*] I have written a descriptive issue title
- [*] I have verified that I am running the latest version of Nancy
- I have verified if the problem exist in both
DEBUGandRELEASEmode - [*] I have searched open and closed issues to ensure it has not already been reported
Description
I want to return a file by url like: http://.../getfile?filename=xxxxx my code is like this:
var file = new FileStream(zipPath, FileMode.Open);
string fileName = //set a filename
var response = new StreamResponse(() => file, MimeTypes.GetMimeType(fileName));
return response.AsAttachment(fileName);when filename is us letter, all ok. when filename include chinese, client cannot get any response, but also no exception.
when I change AsAttachment section to : AsAttachment("fixednamehere.xxx"); it goes well
so I guess is AsAttachment issue.
ps: if only include one or two chinese word, it still ok, client can download file, but got wrong filename. if it include many chinese word, it stuck
System Configuration
- Nancy version:
- Nancy host
- Nancy.Hosting.Aspnet
- [*] Nancy.Hosting.Self
- Nancy.Owin ()
- Other:
- Other Nancy packages and versions:
- Environment (Operating system, version and so on):
- .NET Framework version:
- Additional information:
Source: NancyFx/Nancy