Closed sdheh closed 1 month ago
Thanks @sdheh for the detailed analysis! This could explain some of the other issues.
It may be a little while before I can work on a fix myself since I'm heads-down working on the SPDX 3 upgrade. In the mean time pull requests would be welcome.
I'm pretty sure this is a duplicate of #234.
By the way, the regex match will always include the first 5000 characters before the word "permission" because the beginning is optional and .{0,5000}
is greedy. Is this intended?
By the way, the regex match will always include the first 5000 characters before the word "permission" because the beginning is optional and
.{0,5000}
is greedy. Is this intended?
It may be more efficient to make this match less greedy, but it shouldn't cause a problem since the follow-on calls to the token license matching algorithm will skip the "optional" text.
TLDR: LicenseCompareHelper.matchingStandardLicenseIdsWithinText does not match the MIT license text from https://spdx.org/licenses/MIT.html but LicenseCompareHelper.isTextStandardLicense does. Version: 1.1.11 and allowing the fetching of recent license templates from the internet.
Details (steps to reproduce): I copied the following text from https://spdx.org/licenses/MIT.html and used assigned it to the String
licenseText
:I ran the following code:
This produces the following output:
but the output should be
The problem is in
TemplateRegexMatcher.findTemplateWithinText
, where the startPattern isThe problem is the following part:
There is no
\s*
afterfile)
so that is why this regex does not match the text.