Skip to content
Permalink
Browse files
install: Prevent blowing up on audit malformed response (#42)
PR-URL: #42
Credit: @framp
Reviewed-By: @zkat
  • Loading branch information
framp authored and zkat committed Aug 20, 2018
1 parent de95640 commit 4bd40f543dc89f0721020e7d0bb3497300d74818
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/install.js
@@ -766,6 +766,9 @@ Installer.prototype.printInstalled = function (cb) {
if (!this.auditSubmission) return
return Bluebird.resolve(this.auditSubmission).timeout(10000).catch(() => null)
}).then((auditResult) => {
if (auditResult && !auditResult.metadata) {
log.warn('audit', 'Audit result from registry missing metadata. This is probably an issue with the registry.')
}
// maybe write audit report w/ hash of pjson & shrinkwrap for later reading by `npm audit`
if (npm.config.get('json')) {
return this.printInstalledForJSON(diffs, auditResult)
@@ -834,7 +837,7 @@ Installer.prototype.printInstalledForHuman = function (diffs, auditResult) {
if (removed) actions.push('removed ' + packages(removed))
if (updated) actions.push('updated ' + packages(updated))
if (moved) actions.push('moved ' + packages(moved))
if (auditResult && auditResult.metadata.totalDependencies) {
if (auditResult && auditResult.metadata && auditResult.metadata.totalDependencies) {
actions.push('audited ' + packages(auditResult.metadata.totalDependencies))
}
if (actions.length === 0) {

1 comment on commit 4bd40f5

@kyaw493

This comment has been minimized.

Copy link

@kyaw493 kyaw493 commented on 4bd40f5 Oct 8, 2020

Please sign in to comment.