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: account for packument with no versions #81

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/advisory.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class Advisory {

this[_packument] = packument

const pakuVersions = Object.keys(packument.versions)
const pakuVersions = packument.versions ? Object.keys(packument.versions) : []
const allVersions = new Set([...pakuVersions, ...this.versions])
const versionsAdded = []
const versionsRemoved = []
Expand Down Expand Up @@ -242,7 +242,7 @@ class Advisory {
// check the dependency of this version on the vulnerable dep
// if we got a version that's not in the packument, fall back on
// the spec provided, if possible.
const mani = this[_packument].versions[version] || {
const mani = this[_packument].versions && this[_packument].versions[version] ? this[_packument].versions[version] : {
Copy link
Contributor

Choose a reason for hiding this comment

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

hi @yadirhb, thanks a lot for contributing to this issue, if possible could you try to fix this linting issue so git flow will pass?

Choose a reason for hiding this comment

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

It just needs line-breaks:

const mani = this[_packument].versions && this[_packument].versions[version] ? 
    this[_packument].versions[version] : 
    {

I submitted this PR a few days ago to address that. Should I setup a new one here to get this moving?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

tbh I'm not sure if original author is available to accept your changes or if opening a new PR would help :/

dependencies: {
[this.dependency]: spec,
},
Expand Down