Skip to content

Commit

Permalink
fix: clean uri from audit error (#6220)
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar authored Mar 8, 2023
1 parent b48c43f commit e4de224
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/utils/audit-error.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const log = require('./log-shim')
const replaceInfo = require('./replace-info.js')

// print an error or just nothing if the audit report has an error
// this is called by the audit command, and by the reify-output util
Expand All @@ -24,7 +25,7 @@ const auditError = (npm, report) => {
npm.output(JSON.stringify({
message: error.message,
method: error.method,
uri: error.uri,
uri: replaceInfo(error.uri),
headers: error.headers,
statusCode: error.statusCode,
body,
Expand Down
4 changes: 2 additions & 2 deletions test/lib/utils/audit-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ t.test('error, audit command, json', async t => {
message: 'message',
body: { response: 'body' },
method: 'POST',
uri: 'https://example.com/not/a/registry',
uri: 'https://username:password@example.com/not/a/registry',
headers: {
head: ['ers'],
},
Expand All @@ -101,7 +101,7 @@ t.test('error, audit command, json', async t => {
'{\n' +
' "message": "message",\n' +
' "method": "POST",\n' +
' "uri": "https://example.com/not/a/registry",\n' +
' "uri": "https://username:***@example.com/not/a/registry",\n' +
' "headers": {\n' +
' "head": [\n' +
' "ers"\n' +
Expand Down

0 comments on commit e4de224

Please sign in to comment.