Repository navigation
Fix npm license extraction for selected releases - #226
Open
k-charansai wants to merge 1 commit into
Open
k-charansai wants to merge 1 commit into
k-charansai wants to merge 1 commit into
Conversation
k-charansai
force-pushed
the
fix/npm-release-license-211
branch
from
November 6, 2026 09:36
2be4bc3 to
87b0ec7
Compare
In get_npm_data_from_purl, declared_license was unconditionally set to the
top-level registry document's license, causing older or re-licensed package
versions to incorrectly inherit the package-level license.
Read declared_license from version.get('license') first, falling back to
the top-level license when absent or null. Add regression test covering
per-version license resolution and fallback behavior.
Closes aboutcode-org#211
Signed-off-by: k-charansai <kcharansai052@gmail.com>
k-charansai
force-pushed
the
fix/npm-release-license-211
branch
from
November 6, 2026 09:43
87b0ec7 to
2bd5859
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In
get_npm_data_from_purl, the license was always taken from the top-level npm registry data. This meant that packages with different licenses across releases could end up showing the wrong license.Update the logic to check the selected version's license first, and use the package-level license as a fallback if the version-specific value is missing or
null.Add regression tests to verify that version-specific licenses are picked correctly and that the fallback works as expected.
Closes #211