Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="NuGet.ProjectModel" Version="6.6.0" />
<PackageVersion Include="NuGet.Versioning" Version="6.6.0" />
<PackageVersion Include="packageurl-dotnet" Version="1.0.0" />
<PackageVersion Include="packageurl-dotnet" Version="1.3.0" />
<PackageVersion Include="Polly" Version="7.2.3" />
<PackageVersion Include="SemanticVersioning" Version="2.0.2" />
<PackageVersion Include="Serilog" Version="2.12.0" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Microsoft.ComponentDetection.Contracts.TypedComponent;
namespace Microsoft.ComponentDetection.Contracts.TypedComponent;
using PackageUrl;

public class LinuxComponent : TypedComponent
Expand Down Expand Up @@ -45,7 +45,7 @@ public override PackageURL PackageUrl

if (packageType != null)
{
return new PackageURL(packageType, this.Distribution, this.Name, this.Version, null, null);
return new PackageURL(packageType, this.Distribution.ToLower(), this.Name, this.Version, null, null);
}

return null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Microsoft.ComponentDetection.Contracts.TypedComponent;
namespace Microsoft.ComponentDetection.Contracts.TypedComponent;
using Microsoft.ComponentDetection.Contracts.Internal;
using PackageUrl;

Expand Down Expand Up @@ -29,5 +29,5 @@ public NpmComponent(string name, string version, string hash = null, NpmAuthor a

public override string Id => $"{this.Name} {this.Version} - {this.Type}";

public override PackageURL PackageUrl => new PackageURL("npm", null, this.Name, this.Version, null, null);
public override PackageURL PackageUrl => new PackageURL("npm", null, this.Name.ToLower(), this.Version, null, null);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Microsoft.ComponentDetection.Contracts.TypedComponent;
namespace Microsoft.ComponentDetection.Contracts.TypedComponent;
using System.Collections.Generic;
using PackageUrl;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Microsoft.ComponentDetection.Contracts.Tests;
namespace Microsoft.ComponentDetection.Contracts.Tests;
using FluentAssertions;
using Microsoft.ComponentDetection.Contracts.TypedComponent;
using Microsoft.VisualStudio.TestTools.UnitTesting;
Expand Down Expand Up @@ -95,9 +95,9 @@ public void CocoaPodNameShouldSupportPurl()
var packageThree = new PodComponent("googleUtilities", "7.5.2");

packageOne.PackageUrl.Type.Should().Be("cocoapods");
packageOne.PackageUrl.ToString().Should().Be("pkg:cocoapods/afnetworking@4.0.1");
packageTwo.PackageUrl.ToString().Should().Be("pkg:cocoapods/mapsindoors@3.24.0");
packageThree.PackageUrl.ToString().Should().Be("pkg:cocoapods/googleutilities@7.5.2");
packageOne.PackageUrl.ToString().Should().Be("pkg:cocoapods/AFNetworking@4.0.1");
packageTwo.PackageUrl.ToString().Should().Be("pkg:cocoapods/MapsIndoors@3.24.0");
packageThree.PackageUrl.ToString().Should().Be("pkg:cocoapods/googleUtilities@7.5.2");
}

[TestMethod]
Expand All @@ -106,6 +106,6 @@ public void CocoaPodNameShouldPurlWithCustomQualifier()
// https://github.com/package-url/purl-spec/blob/b8ddd39a6d533b8895f3b741f2e62e2695d82aa4/PURL-TYPES.rst#cocoapods
var packageOne = new PodComponent("AFNetworking", "4.0.1", "https://custom_repo.example.com/path/to/repo/specs.git");

packageOne.PackageUrl.ToString().Should().Be("pkg:cocoapods/afnetworking@4.0.1?repository_url=https://custom_repo.example.com/path/to/repo/specs.git");
packageOne.PackageUrl.ToString().Should().Be("pkg:cocoapods/AFNetworking@4.0.1?repository_url=https://custom_repo.example.com/path/to/repo/specs.git");
}
}