Match LICENSES entries by full name before dot-stripping

This meant that for a repository with
  LICENSES/
    0BSD
    GPL-2.0
only 0BSD was detected.

So keep allowing LICENSES/0BSD.jpeg,
but also don't break LICENSES/GPL-2.0.
This commit is contained in:
наб 2023-09-29 17:52:54 +02:00 committed by Drew DeVault
parent e7fb739535
commit 631e5dbc17
1 changed files with 3 additions and 1 deletions

View File

@ -52,7 +52,9 @@ def get_license_info_for_tip(tip):
licenses = []
if 'LICENSES' in tip.tree and isinstance(tip.tree['LICENSES'], pygit2.Tree):
for o in tip.tree['LICENSES']:
license_id = os.path.splitext(o.name)[0]
license_id = o.name
if license_id not in SPDX_LICENSES:
license_id = os.path.splitext(o.name)[0]
if license_id in SPDX_LICENSES:
licenses.append({
'id': license_id,