Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved fetching license information for npm packages #672

Conversation

puchta
Copy link
Contributor

@puchta puchta commented Oct 26, 2023

No description provided.

Signed-off-by: Jacek Puchta <[email protected]>
@puchta puchta force-pushed the issue-671-fix-fetching-license-information-for-npm-packages branch 3 times, most recently from 7718861 to 3938f30 Compare October 26, 2023 10:29
@puchta puchta force-pushed the issue-671-fix-fetching-license-information-for-npm-packages branch from 3938f30 to cc4a2b3 Compare October 26, 2023 10:32
Signed-off-by: Jacek Puchta <[email protected]>
@@ -3095,6 +3098,9 @@ export const getRepoLicense = async function (repoUrl, repoMetadata) {
if (!repoUrl) {
repoUrl = toGitHubUrl(repoMetadata);
}
if (repoUrl.startsWith("git://") && repoUrl.endsWith(".git")) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this logic is true only for a handful of providers such as github. There might be other places that do this, so fine for now.
Could we split this into two conditions so that we also handle the case where the URL starts with git+https and doesn't end with .git?

Eg: git+https
https://github.com/CycloneDX/cdxgen/blob/master/package.json#L52

Below is also valid since don't think npm performs any validation.

git+https://github.com/CycloneDX/cdxgen

@prabhu prabhu merged commit b3f3213 into CycloneDX:master Oct 26, 2023
@prabhu
Copy link
Collaborator

prabhu commented Oct 26, 2023

Thank you!

@puchta puchta deleted the issue-671-fix-fetching-license-information-for-npm-packages branch October 27, 2023 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants