Index: pkg/http/lib/src/multipart_file.dart |
diff --git a/pkg/http/lib/src/multipart_file.dart b/pkg/http/lib/src/multipart_file.dart |
index aa30fc350989bd82a6a98f7e92e13ae6696ef45b..e2cca1a37e7cb18bcf0493cf6acad5a8457e4ec7 100644 |
--- a/pkg/http/lib/src/multipart_file.dart |
+++ b/pkg/http/lib/src/multipart_file.dart |
@@ -67,12 +67,14 @@ class MultipartFile { |
/// the future may be inferred from [filename]. |
factory MultipartFile.fromString(String field, String value, |
{String filename, ContentType contentType}) { |
- contentType = contentType == null ? new ContentType("text", "plain") : |
- // Make a copy of the original contentType so we can modify charset. |
- new ContentType.fromString(contentType.toString()); |
+ contentType = contentType == null ? new ContentType("text", "plain") |
+ : contentType; |
var charset = contentType.charset; |
var encoding = encodingForCharset(contentType.charset, Encoding.UTF_8); |
- contentType.charset = encoding.name; |
+ // Make a new contentType with ensured charset. |
+ contentType = new ContentType(contentType.primaryType, |
+ contentType.subType, |
+ encoding.name); |
nweiz
2013/03/05 20:43:18
This needs to copy all the parameters from the ori
Søren Gjesse
2013/03/06 13:23:30
Done.
|
return new MultipartFile.fromBytes(field, encodeString(value, encoding), |
filename: filename, |