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

Error when using Content.UploadAsync to upload file with chinese file name #5

Closed
frankyuan opened this Issue Apr 28, 2017 · 2 comments

Comments

Projects
None yet
5 participants
@frankyuan
Copy link

frankyuan commented Apr 28, 2017

I'm trying to upload file with Chinese file name to sensenet using Content.UploadAsync. For some file names, such as 运维管理.txt , there is an exception "Specified value has invalid Control characters. Parameter name: value". If rename to another file name, maybe it works well. Seems like encode issue. Could you give me some suggestions?

I'm trying to upload file with Chinese file name to sensenet using Content.UploadAsync. For some file names, such as 运维管理.txt , there is an exception "Specified value has invalid Control characters. Parameter name: value". If rename to another file name, maybe it works well. Seems like encode issue. Could you give me some suggestions?

My code:

using (var stream = new FileStream(localFilePath, FileMode.Open))
{
await Content.UploadAsync(parentPath, fileName, stream, "File");
}
StackTrace:

at System.Net.WebHeaderCollection.CheckBadChars(String name, Boolean isHeaderValue)
at System.Net.WebHeaderCollection.Add(String name, String value)
at SenseNet.Client.RESTCaller.CreateChunkUploadWebRequest(String url, ServerContext server, UploadData uploadData, String boundary, Stream& requestStream) in sn-client-dotnet-master\sn-client-dotnet-master\src\SenseNet.Client\RESTCaller.cs:line 620
at SenseNet.Client.RESTCaller.d__23.MoveNext() in sn-client-dotnet-master\sn-client-dotnet-master\src\SenseNet.Client\RESTCaller.cs:line 490

@tusmester tusmester added the bug label Apr 28, 2017

@tusmester

This comment has been minimized.

Copy link
Member

tusmester commented Apr 28, 2017

(We should update the original SO question when this is solved.)

It is possible that we should handle this on both client and server side (meaning a modification should be made in the main sensenet repo too), to make the server (UploadAction) understand both the filename and filename*. properties of the Content-Disposition header.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition

@herflis herflis added the help wanted label Dec 8, 2017

drwatson1 added a commit to drwatson1/sn-client-dotnet that referenced this issue May 21, 2018

@tusmester tusmester added this to the Sprint 159 milestone May 22, 2018

@kavics kavics self-assigned this May 29, 2018

tusmester added a commit that referenced this issue May 29, 2018

Merge pull request #9 from drwatson1/master
#5 Error when using Content.UploadAsync to upload file with chinese file name
@tusmester

This comment has been minimized.

Copy link
Member

tusmester commented May 29, 2018

Thank you @frankyuan and @drwatson1 for your patience, we released the fix in v1.1.1.

@kultsar kultsar closed this May 30, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment