Skip to content

Commit 4cbaeaa

Browse files
committed
make email optional
Signed-off-by: andreas hilti <69210561+andreas-hilti@users.noreply.github.com>
1 parent 6bffc9a commit 4cbaeaa

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

src/CycloneDX.Spdx.Interop/Converters/v2_3/Helpers/Bom/Creators.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,12 @@ public static void AddSpdxCreators(this Bom bom, List<string> creators)
8484
if (nonToolMatch.Success)
8585
{
8686
if (bom.Metadata.Authors == null) { bom.Metadata.Authors = new List<OrganizationalContact>(); }
87+
var email = nonToolMatch.Groups["email"].ToString();
8788
bom.Metadata.Authors.Add(new OrganizationalContact
8889
{
8990
Name = nonToolMatch.Groups["name"].ToString(),
90-
Email = nonToolMatch.Groups["email"].ToString(),
91+
// email is optional
92+
Email = email != "" ? email: null,
9193
});
9294
if (creator.StartsWith("Organization:"))
9395
{

tests/CycloneDX.Spdx.Interop.Tests/__snapshots__/ConverterTests.FromSpdxToCDXTest_v2.2document.snap

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@
1111
],
1212
"authors": [
1313
{
14-
"name": "ExampleCodeInspect",
15-
"email": ""
14+
"name": "ExampleCodeInspect"
1615
},
1716
{
18-
"name": "Jane Doe",
19-
"email": ""
17+
"name": "Jane Doe"
2018
}
2119
],
2220
"properties": [

tests/CycloneDX.Spdx.Interop.Tests/__snapshots__/ConverterTests.FromSpdxToCDXTest_v2.3document.snap

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@
1111
],
1212
"authors": [
1313
{
14-
"name": "ExampleCodeInspect",
15-
"email": ""
14+
"name": "ExampleCodeInspect"
1615
},
1716
{
18-
"name": "Jane Doe",
19-
"email": ""
17+
"name": "Jane Doe"
2018
}
2119
],
2220
"properties": [

0 commit comments

Comments
 (0)