Skip to content
This repository has been archived by the owner on Nov 20, 2018. It is now read-only.

filename* is lost when creating the FormFile class #651

Closed
cweb opened this issue Jun 8, 2016 · 1 comment
Closed

filename* is lost when creating the FormFile class #651

cweb opened this issue Jun 8, 2016 · 1 comment
Assignees

Comments

@cweb
Copy link

cweb commented Jun 8, 2016

When a multipart form includes a filename using RFC 5987 encoding semantics such as:

filename*=UTF-8''foo-%c3%a4.html

That filename is lost when the FormFile class is created. The issue starts at line 184 in FormFeature.cs:

https://github.com/aspnet/HttpAbstractions/blob/dev/src/Microsoft.AspNetCore.Http/Features/FormFeature.cs#L184

At this point, contentDisposition.FileName is null, because contentDisposition.FileNameStar contains the value of the filename.

To reproduce this issue in test, send the following request:

POST /Home/formtest HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:29.0) Gecko/20100101 Firefox/29.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Cookie: __atuvc=34%7C7; permanent=0; _gitlab_session=226ad8a0be43681acf38c2fab9497240; __profilin=p%3Dt; request_method=GET
Connection: keep-alive
Content-Type: multipart/form-data; boundary=---------------------------9051914041544843365972754266
Content-Length: 408

-----------------------------9051914041544843365972754266
Content-Disposition: form-data; name="first part"

this is content of the first part
-----------------------------9051914041544843365972754266
Content-Disposition: form-data; name="file part";  filename*=UTF-8''foo-%c3%a4.html
Content-Type: text/plain

This is content of the file.
-----------------------------9051914041544843365972754266--
@Tratcher Tratcher added the bug label Jun 8, 2016
@Tratcher
Copy link
Member

Tratcher commented Jun 8, 2016

It's an easy fix, but not urgent. This is why the RFC recommends clients set both fields.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants