Skip to content

Commit

Permalink
Fix Error with Uppercase Characters in Version Strings
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
JohnHunhoff committed Aug 6, 2024
1 parent ed8fd7d commit bea5f0f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CycloneDX/Services/NugetV3Service.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand Down

0 comments on commit bea5f0f

Please sign in to comment.