Skip to content

Commit 3ea735f

Browse files
committed
fix condition for concatenating =
1 parent 7492bb1 commit 3ea735f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

spdxexp/extracts_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ func TestExtractLicenses(t *testing.T) {
1616
{"AND'ed licenses", "MIT AND Apache-2.0", []string{"MIT", "Apache-2.0"}},
1717
{"AND'ed & OR'ed licenses", "(MIT AND Apache-2.0) OR GPL-3.0", []string{"GPL-3.0", "MIT", "Apache-2.0"}},
1818
{"ONLY modifiers", "LGPL-2.1-only OR MIT OR BSD-3-Clause", []string{"MIT", "BSD-3-Clause", "LGPL-2.1-only"}},
19-
{"WITH modifiers", "GPL-2.0-or-later WITH Bison-exception-2.2", []string{"GPL-2.0-or-later+ WITH Bison-exception-2.2"}},
19+
{"WITH modifiers", "GPL-2.0-or-later WITH Bison-exception-2.2", []string{"GPL-2.0-or-later WITH Bison-exception-2.2"}},
2020
{"Invalid SPDX expression", "MIT OR INVALID", nil},
21+
{"+ operator in GPL", "GPL-2.0-Or-later", []string{"GPL-2.0-or-later"}},
22+
{"+ operator in Apache", "APACHE-2.0+", []string{"Apache-2.0+"}},
2123
}
2224

2325
for _, test := range tests {

spdxexp/node.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ func (n *node) reconstructedLicenseString() *string {
150150
switch n.role {
151151
case licenseNode:
152152
license := *n.license()
153-
if n.hasPlus() {
153+
if n.hasPlus() && !strings.HasSuffix(strings.ToLower(license), "-or-later") {
154154
license += "+"
155155
}
156156
if n.hasException() {

0 commit comments

Comments
 (0)