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

fix: tolerate null bugs URLs #6798

Merged
merged 1 commit into from
Sep 13, 2023
Merged

Conversation

vladh
Copy link
Contributor

@vladh vladh commented Sep 12, 2023

Currently, if the bugs URL returned from package.json, which is processed through
hosted-git-info, is falsy, an error is thrown. However, hosted-git-info may well return a falsy bugs URL. This can happen when there is no bugs URL in the repo, but hosted-git-info tries to infer one, but one cannot be inferred, for example if the repository URL is a SourceHut URL. This is described here: npm/hosted-git-info#213

For this reason, we should tolerate falsy URLs and fall back to whatever is defined in bugs.js, in this case being sent to https://www.npmjs.com/package/.

lib/commands/bugs.js Outdated Show resolved Hide resolved
lib/commands/bugs.js Outdated Show resolved Hide resolved
Currently, if the bugs URL returned from `package.json`, which is
processed through
[hosted-git-info](https://github.com/npm/hosted-git-info), is falsy, an
error is thrown. However, hosted-git-info may well return a falsy bugs
URL. This can happen when there is no bugs URL in the repo, but
hosted-git-info tries to infer one, but one cannot be inferred, for
example if the repository URL is a SourceHut URL. This is described
here: npm/hosted-git-info#213

For this reason, we should tolerate falsy URLs and fall back to whatever
is defined in `bugs.js`, in this case being sent to
https://www.npmjs.com/package/<packageName>.
@vladh
Copy link
Contributor Author

vladh commented Sep 12, 2023

@wraithgar Thank you for the feedback! I think this should do it.

@wraithgar wraithgar merged commit d46d052 into npm:latest Sep 13, 2023
20 checks passed
@github-actions github-actions bot mentioned this pull request Sep 13, 2023
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.

None yet

2 participants