From bea5f0f78e349e8ffd98bbfa0837caefc66bc5cd Mon Sep 17 00:00:00 2001 From: John Hunhoff Date: Mon, 5 Aug 2024 23:20:29 -0300 Subject: [PATCH] Fix Error with Uppercase Characters in Version Strings Resolve an issue where versions with uppercase characters (e.g., 1.0.0-Beta, 1.0.0.BETA.1) caused CycloneDX to throw errors. The problem occurred because the NuGet cache converted version strings to lowercase for path names. Signed-off-by: John Hunhoff --- CycloneDX/Services/NugetV3Service.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CycloneDX/Services/NugetV3Service.cs b/CycloneDX/Services/NugetV3Service.cs index 923eba4d..5fdfb040 100644 --- a/CycloneDX/Services/NugetV3Service.cs +++ b/CycloneDX/Services/NugetV3Service.cs @@ -80,11 +80,12 @@ internal string GetCachedNuspecFilename(string name, string version) if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(version)) { return null; } var lowerName = name.ToLowerInvariant(); + var lowerVersion = version.ToLowerInvariant(); string nuspecFilename = null; foreach (var packageCachePath in _packageCachePaths) { - var currentDirectory = _fileSystem.Path.Combine(packageCachePath, lowerName, NormalizeVersion(version)); + var currentDirectory = _fileSystem.Path.Combine(packageCachePath, lowerName, NormalizeVersion(lowerVersion)); var currentFilename = _fileSystem.Path.Combine(currentDirectory, lowerName + _nuspecExtension); if (_fileSystem.File.Exists(currentFilename)) {