Merge pull request #2778 from xmcclure/checked-build-updates-2
[mono.git] / mcs / class / System.Net.Http / System.Net.Http.Headers / ContentDispositionHeaderValue.cs
index 0e28b7283881ec2beedb1632dcff2d819b74a1fd..f80e50e41431ff0013d257f124aa2708867252fb 100644 (file)
@@ -120,9 +120,17 @@ namespace System.Net.Http.Headers
 
                public string Name {
                        get {
-                               return FindParameter ("name");
+                               var value = FindParameter ("name");
+
+                               if (value == null)
+                                       return null;
+
+                               return DecodeValue (value, false);
                        }
                        set {
+                               if (value != null)
+                                       value = EncodeBase64Value (value);
+
                                SetValue ("name", value);
                        }
                }
@@ -249,6 +257,11 @@ namespace System.Net.Http.Headers
                                        continue;
                                }
 
+                               if (!Lexer.IsValidCharacter (ch) || ch == '*' || ch == '?' || ch == '%') {
+                                       sb.Append (Uri.HexEscape (ch));
+                                       continue;
+                               }
+
                                sb.Append (ch);
                        }