Skip to content

Commit

Permalink
(chocolatey#508) Make package id comparisons case insensitive
Browse files Browse the repository at this point in the history
This helps ensure that package IDs are handled in a case
insensitive manner.
  • Loading branch information
TheCakeIsNaOH committed Jul 1, 2023
1 parent d836138 commit 10072aa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/chocolatey/infrastructure.app/services/NugetService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ public void InstallDryRun(ChocolateyConfiguration config, Action<PackageResult,
if (packageNames.Count == 1)
{
var packageName = packageNames.DefaultIfEmpty(string.Empty).FirstOrDefault();
if (packageName.EndsWith(NuGetConstants.PackageExtension) || packageName.EndsWith(PackagingConstants.ManifestExtension))
if (packageName.EndsWith(NuGetConstants.PackageExtension, StringComparison.OrdinalIgnoreCase) || packageName.EndsWith(PackagingConstants.ManifestExtension, StringComparison.OrdinalIgnoreCase))
{
this.Log().Warn(ChocolateyLoggers.Important, "DEPRECATION WARNING");
this.Log().Warn(InstallWithFilePathDeprecationMessage);
Expand All @@ -509,7 +509,7 @@ public void InstallDryRun(ChocolateyConfiguration config, Action<PackageResult,

config.Sources = _fileSystem.GetDirectoryName(_fileSystem.GetFullPath(packageName));

if (packageName.EndsWith(PackagingConstants.ManifestExtension))
if (packageName.EndsWith(PackagingConstants.ManifestExtension, StringComparison.OrdinalIgnoreCase))
{
packageNames.Add(_fileSystem.GetFilenameWithoutExtension(packageName));

Expand Down Expand Up @@ -553,7 +553,7 @@ public void InstallDryRun(ChocolateyConfiguration config, Action<PackageResult,

var installedPackage = allLocalPackages.FirstOrDefault(p => p.Name.IsEqualTo(packageName));

if (Platform.GetPlatform() != PlatformType.Windows && !packageName.EndsWith(".template"))
if (Platform.GetPlatform() != PlatformType.Windows && !packageName.EndsWith(".template", StringComparison.OrdinalIgnoreCase))
{
string logMessage = "{0} is not a supported package on non-Windows systems.{1}Only template packages are currently supported.".FormatWith(packageName, Environment.NewLine);
this.Log().Warn(ChocolateyLoggers.Important, logMessage);
Expand Down

0 comments on commit 10072aa

Please sign in to comment.