diff --git a/src/Dapr.Jobs/Extensions/StringExtensions.cs b/src/Dapr.Jobs/Extensions/StringExtensions.cs
index b75ec33f..98e3525d 100644
--- a/src/Dapr.Jobs/Extensions/StringExtensions.cs
+++ b/src/Dapr.Jobs/Extensions/StringExtensions.cs
@@ -20,6 +20,8 @@ internal static class StringExtensions
///
/// The string value to evaluate.
/// The possible values to look for a match within.
- ///
- public static bool EndsWithAny(this string value, IReadOnlyList possibleValues) => possibleValues.Any(value.EndsWith);
+ /// The type of string comparison to perform.
+ /// True if the value ends with any of the possible values; otherwise false.
+ public static bool EndsWithAny(this string value, IReadOnlyList possibleValues,
+ StringComparison comparisonType) => possibleValues.Any(val => value.EndsWith(val, comparisonType));
}
diff --git a/src/Dapr.Jobs/Models/DaprJobSchedule.cs b/src/Dapr.Jobs/Models/DaprJobSchedule.cs
index 5f5e16e7..5aa110f0 100644
--- a/src/Dapr.Jobs/Models/DaprJobSchedule.cs
+++ b/src/Dapr.Jobs/Models/DaprJobSchedule.cs
@@ -124,7 +124,7 @@ public static DaprJobSchedule FromDuration(TimeSpan duration)
public bool IsPrefixedPeriodExpression =>
ExpressionValue.StartsWith('@') &&
(isEveryExpression.IsMatch(ExpressionValue) ||
- ExpressionValue.EndsWithAny(acceptablePeriodValues));
+ ExpressionValue.EndsWithAny(acceptablePeriodValues, StringComparison.InvariantCulture));
///
/// Reflects that the schedule represents a fixed point in time.
diff --git a/test/Dapr.Jobs.Test/Extensions/StringExtensionsTests.cs b/test/Dapr.Jobs.Test/Extensions/StringExtensionsTests.cs
index 06ded66e..8c25de11 100644
--- a/test/Dapr.Jobs.Test/Extensions/StringExtensionsTests.cs
+++ b/test/Dapr.Jobs.Test/Extensions/StringExtensionsTests.cs
@@ -11,6 +11,7 @@
// limitations under the License.
// ------------------------------------------------------------------------
+using System;
using System.Collections.Generic;
using Dapr.Jobs.Extensions;
using Xunit;
@@ -31,7 +32,7 @@ public void EndsWithAny_ContainsMatch()
"daily",
"midnight",
"hourly"
- });
+ }, StringComparison.InvariantCulture);
Assert.True(result);
}
@@ -39,7 +40,7 @@ public void EndsWithAny_ContainsMatch()
public void EndsWithAny_DoesNotContainMatch()
{
const string testValue = "@weekly";
- var result = testValue.EndsWithAny(new List { "every", "monthly", "daily", "midnight", "hourly" });
+ var result = testValue.EndsWithAny(new List { "every", "monthly", "daily", "midnight", "hourly" }, StringComparison.InvariantCulture);
Assert.False(result);
}
}