Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit b2e86cf

Browse files
justinvpjkotas
authored andcommitted
Unix: Specify Ordinal comparison in TimeZoneInfo (#15739)
The default behavior for StartsWith uses the current culture for comparisons. These should be ordinal.
1 parent 6faa6bb commit b2e86cf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/mscorlib/src/System/TimeZoneInfo.Unix.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ private static string FindTimeZoneIdUsingReadLink(string tzFilePath)
390390
symlinkPath = Path.Combine(tzFilePath, symlinkPath);
391391

392392
string timeZoneDirectory = GetTimeZoneDirectory();
393-
if (symlinkPath.StartsWith(timeZoneDirectory))
393+
if (symlinkPath.StartsWith(timeZoneDirectory, StringComparison.Ordinal))
394394
{
395395
id = symlinkPath.Substring(timeZoneDirectory.Length);
396396
}
@@ -426,7 +426,7 @@ private static string FindTimeZoneId(byte[] rawData)
426426
id = filePath;
427427

428428
// strip off the root time zone directory
429-
if (id.StartsWith(timeZoneDirectory))
429+
if (id.StartsWith(timeZoneDirectory, StringComparison.Ordinal))
430430
{
431431
id = id.Substring(timeZoneDirectory.Length);
432432
}

0 commit comments

Comments
 (0)