mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
Audit culture bugs (#7707)
* Added comments and fixed CultureInfo / StringComparison where appropriate * Addressed comments * Fixed comment
This commit is contained in:
@@ -70,6 +70,8 @@ namespace Wox.Infrastructure.Exception
|
||||
|
||||
sb.AppendLine("## Environment");
|
||||
sb.AppendLine($"* Command Line: {Environment.CommandLine}");
|
||||
|
||||
// Using InvariantCulture since this is internal
|
||||
sb.AppendLine($"* Timestamp: {DateTime.Now.ToString(CultureInfo.InvariantCulture)}");
|
||||
sb.AppendLine($"* Wox version: {Constant.Version}");
|
||||
sb.AppendLine($"* OS Version: {Environment.OSVersion.VersionString}");
|
||||
|
||||
@@ -131,6 +131,7 @@ namespace Wox.Infrastructure.Image
|
||||
return new ImageResult(ImageCache[path], ImageType.Cache);
|
||||
}
|
||||
|
||||
// Using OrdinalIgnoreCase since this is internal and used with paths
|
||||
if (path.StartsWith("data:", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var imageSource = new BitmapImage(new Uri(path));
|
||||
|
||||
@@ -106,8 +106,8 @@ namespace Wox.Infrastructure.Storage
|
||||
|
||||
private void BackupOriginFile()
|
||||
{
|
||||
// Using CurrentCulture since this is user facing
|
||||
var timestamp = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss-fffffff", CultureInfo.CurrentCulture);
|
||||
// Using InvariantCulture since this is internal
|
||||
var timestamp = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss-fffffff", CultureInfo.InvariantCulture);
|
||||
var directory = Path.GetDirectoryName(FilePath).NonNull();
|
||||
var originName = Path.GetFileNameWithoutExtension(FilePath);
|
||||
var backupName = $"{originName}-{timestamp}{FileSuffix}";
|
||||
|
||||
@@ -249,6 +249,7 @@ namespace Wox.Infrastructure
|
||||
}
|
||||
}
|
||||
|
||||
// Using CurrentCultureIgnoreCase since this relates to queries input by user
|
||||
if (string.Equals(query, stringToCompare, StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
var bonusForExactMatch = 10;
|
||||
|
||||
Reference in New Issue
Block a user