Skip to content

Commit

Permalink
Allow leading/trailing whitespace in length prefix for (NOT) STARTS/E…
Browse files Browse the repository at this point in the history
…NDS WITH ANY OF comparators to align behavior with other SDKs
  • Loading branch information
adams85 committed Feb 22, 2024
1 parent 3bda929 commit a17a9d0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/ConfigCat.Client.Tests/ConfigV2EvaluationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -736,10 +736,10 @@ public void ComparisonAttributeTrimming_Test(string key, string expectedReturnVa
[DataRow("notendswithanyof", "no trim")]
[DataRow("arraycontainsanyof", "no trim")]
[DataRow("arraynotcontainsanyof", "no trim")]
[DataRow("startwithanyofhashed", "default")]
[DataRow("notstartwithanyofhashed", "default")]
[DataRow("endswithanyofhashed", "default")]
[DataRow("notendswithanyofhashed", "default")]
[DataRow("startwithanyofhashed", "no trim")]
[DataRow("notstartwithanyofhashed", "no trim")]
[DataRow("endswithanyofhashed", "no trim")]
[DataRow("notendswithanyofhashed", "no trim")]
//semver comparator values trimmed because of backward compatibility
[DataRow("semverisoneof", "4 trim")]
[DataRow("semverisnotoneof", "5 trim")]
Expand Down
2 changes: 1 addition & 1 deletion src/ConfigCatClient/Evaluation/RolloutEvaluator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ private static bool EvaluateSensitiveTextSliceEqualsAnyOf(string text, string[]?

var index = item.IndexOf('_');
if (index < 0
|| !int.TryParse(item.AsSpan(0, index).ToParsable(), NumberStyles.None, CultureInfo.InvariantCulture, out var sliceLength)
|| !int.TryParse(item.AsSpan(0, index).ToParsable(), NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite, CultureInfo.InvariantCulture, out var sliceLength)
|| (hash2 = item.AsSpan(index + 1)).IsEmpty)
{
EnsureComparisonValue<string>(null);
Expand Down

0 comments on commit a17a9d0

Please sign in to comment.