Skip to content

Commit f95dc3e

Browse files
committed
Merge branch 'release/7.1.0'
2 parents 046fab5 + 2a37e57 commit f95dc3e

File tree

6 files changed

+29
-17
lines changed

6 files changed

+29
-17
lines changed

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"isRoot": true,
44
"tools": {
55
"cake.tool": {
6-
"version": "2.2.0",
6+
"version": "2.3.0",
77
"commands": [
88
"dotnet-cake"
99
]

Source/HttpMultipartParser.UnitTests/ParserScenarios/TestData.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ private bool ValidateFiles(MultipartFormDataParser parser)
113113
if (expectedFile.ContentDisposition != actualFile.ContentDisposition) return false;
114114

115115
if (expectedFile.AdditionalProperties.Count != actualFile.AdditionalProperties.Count) return false;
116-
if (expectedFile.AdditionalProperties.Except(actualFile.AdditionalProperties).Any()) return false;
116+
if (expectedFile.AdditionalProperties.Any(pair => !actualFile.AdditionalProperties.Keys.Contains(pair.Key, StringComparer.OrdinalIgnoreCase))) return false;
117+
if (actualFile.AdditionalProperties.Any(pair => !expectedFile.AdditionalProperties.Keys.Contains(pair.Key, StringComparer.OrdinalIgnoreCase))) return false;
118+
if (expectedFile.AdditionalProperties.Any(pair => actualFile.AdditionalProperties[pair.Key] != pair.Value)) return false; // Case-sensitive
117119

118120
// Read the data from the files and see if it's the same
119121
if (expectedFile.Data.CanSeek && expectedFile.Data.Position != 0) expectedFile.Data.Position = 0;

Source/HttpMultipartParser/FilePart.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
// </summary>
2525
// --------------------------------------------------------------------------------------------------------------------
2626

27+
using System;
2728
using System.Collections.Generic;
2829
using System.Collections.ObjectModel;
2930
using System.IO;
@@ -97,7 +98,7 @@ public FilePart(string name, string fileName, Stream data, IDictionary<string, s
9798
Data = data;
9899
ContentType = contentType;
99100
ContentDisposition = contentDisposition;
100-
AdditionalProperties = new ReadOnlyDictionary<string, string>(additionalProperties ?? new Dictionary<string, string>());
101+
AdditionalProperties = new ReadOnlyDictionary<string, string>(additionalProperties ?? new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase));
101102
}
102103

103104
#endregion

Source/HttpMultipartParser/StreamingMultipartFormDataParser.cs

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,10 @@ private static async Task<string> DetectBoundaryAsync(RebufferableBinaryReader r
364364
/// </summary>
365365
/// <param name="parameters">The section parameters.</param>
366366
/// <returns>true if the section contains a file, false otherwise.</returns>
367-
private bool IsFilePart(IDictionary<string, string> parameters!!)
367+
private bool IsFilePart(IDictionary<string, string> parameters)
368368
{
369+
if (parameters == null) throw new ArgumentNullException(nameof(parameters));
370+
369371
// A section without any parameter is invalid. It is very likely to contain just a bunch of blank lines.
370372
if (parameters.Count == 0) return false;
371373

@@ -388,8 +390,10 @@ private bool IsFilePart(IDictionary<string, string> parameters!!)
388390
/// </summary>
389391
/// <param name="parameters">The section parameters.</param>
390392
/// <returns>true if the section contains a data parameter, false otherwise.</returns>
391-
private bool IsParameterPart(IDictionary<string, string> parameters!!)
393+
private bool IsParameterPart(IDictionary<string, string> parameters)
392394
{
395+
if (parameters == null) throw new ArgumentNullException(nameof(parameters));
396+
393397
// A section without any parameter is invalid. It is very likely to contain just a bunch of blank lines.
394398
if (parameters.Count == 0) return false;
395399

@@ -1052,7 +1056,7 @@ private void ParseSection(RebufferableBinaryReader reader)
10521056
// in the case of single file uploads. Multi-file uploads have Content-Disposition: file according
10531057
// to the spec however in practise it seems that multiple files will be represented by
10541058
// multiple Content-Disposition: form-data files.
1055-
var parameters = new Dictionary<string, string>();
1059+
var parameters = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
10561060

10571061
string line = reader.ReadLine();
10581062
while (line != string.Empty)
@@ -1087,8 +1091,9 @@ private void ParseSection(RebufferableBinaryReader reader)
10871091

10881092
// Limit split to 2 splits so we don't accidently split characters in file paths.
10891093
.ToDictionary(
1090-
x => x[0].Trim().Replace("\"", string.Empty).ToLower(),
1091-
x => x[1].Trim().Replace("\"", string.Empty));
1094+
x => x[0].Trim().Replace("\"", string.Empty),
1095+
x => x[1].Trim().Replace("\"", string.Empty),
1096+
StringComparer.OrdinalIgnoreCase);
10921097

10931098
// Here we just want to push all the values that we just retrieved into the
10941099
// parameters dictionary.
@@ -1151,7 +1156,7 @@ private async Task ParseSectionAsync(RebufferableBinaryReader reader, Cancellati
11511156
// in the case of single file uploads. Multi-file uploads have Content-Disposition: file according
11521157
// to the spec however in practise it seems that multiple files will be represented by
11531158
// multiple Content-Disposition: form-data files.
1154-
var parameters = new Dictionary<string, string>();
1159+
var parameters = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
11551160

11561161
string line = await reader.ReadLineAsync(cancellationToken).ConfigureAwait(false);
11571162
while (line != string.Empty)
@@ -1186,8 +1191,9 @@ private async Task ParseSectionAsync(RebufferableBinaryReader reader, Cancellati
11861191

11871192
// Limit split to 2 splits so we don't accidently split characters in file paths.
11881193
.ToDictionary(
1189-
x => x[0].Trim().Replace("\"", string.Empty).ToLower(),
1190-
x => x[1].Trim().Replace("\"", string.Empty));
1194+
x => x[0].Trim().Replace("\"", string.Empty),
1195+
x => x[1].Trim().Replace("\"", string.Empty),
1196+
StringComparer.OrdinalIgnoreCase);
11911197

11921198
// Here we just want to push all the values that we just retrieved into the
11931199
// parameters dictionary.
@@ -1269,8 +1275,11 @@ private IDictionary<string, string> GetAdditionalParameters(IDictionary<string,
12691275
{
12701276
var wellKnownParameters = new[] { "name", "filename", "content-type", "content-disposition" };
12711277
var additionalParameters = parameters
1272-
.Where(param => !wellKnownParameters.Contains(param.Key))
1273-
.ToDictionary(x => x.Key, x => x.Value);
1278+
.Where(param => !wellKnownParameters.Contains(param.Key, StringComparer.OrdinalIgnoreCase))
1279+
.ToDictionary(
1280+
x => x.Key,
1281+
x => x.Value,
1282+
StringComparer.OrdinalIgnoreCase);
12741283
return additionalParameters;
12751284
}
12761285

build.cake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// Install tools.
22
#tool dotnet:?package=GitVersion.Tool&version=5.10.3
3-
#tool dotnet:?package=coveralls.net&version=4.0.0
3+
#tool dotnet:?package=coveralls.net&version=4.0.1
44
#tool nuget:?package=GitReleaseManager&version=0.13.0
5-
#tool nuget:?package=ReportGenerator&version=5.1.9
6-
#tool nuget:?package=xunit.runner.console&version=2.4.1
5+
#tool nuget:?package=ReportGenerator&version=5.1.10
6+
#tool nuget:?package=xunit.runner.console&version=2.4.2
77
#tool nuget:?package=Codecov&version=1.13.0
88

99
// Install addins.

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "6.0.301",
3+
"version": "6.0.401",
44
"rollForward": "latestFeature"
55
}
66
}

0 commit comments

Comments
 (0)