diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/DotNetOpenAuth/Messaging/MultipartPostPart.cs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/DotNetOpenAuth/Messaging/MultipartPostPart.cs b/src/DotNetOpenAuth/Messaging/MultipartPostPart.cs index 9f1170f..f9a5988 100644 --- a/src/DotNetOpenAuth/Messaging/MultipartPostPart.cs +++ b/src/DotNetOpenAuth/Messaging/MultipartPostPart.cs @@ -116,6 +116,10 @@ namespace DotNetOpenAuth.Messaging { /// <param name="contentType">Type of the content in HTTP Content-Type format.</param> /// <returns>The constructed part.</returns> public static MultipartPostPart CreateFormFilePart(string name, string filePath, string contentType) { + Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(name)); + Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(filePath)); + Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(contentType)); + string fileName = Path.GetFileName(filePath); return CreateFormFilePart(name, fileName, contentType, File.OpenRead(filePath)); } @@ -130,8 +134,8 @@ namespace DotNetOpenAuth.Messaging { /// <returns>The constructed part.</returns> public static MultipartPostPart CreateFormFilePart(string name, string fileName, string contentType, Stream content) { Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(name)); - Contract.Requires<ArgumentException>(fileName != null); - Contract.Requires<ArgumentException>(contentType != null); + Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(fileName)); + Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(contentType)); Contract.Requires<ArgumentException>(content != null); var part = new MultipartPostPart("file"); |