Skip to content

Commit e4de224

Browse files
authored
fix: clean uri from audit error (#6220)
1 parent b48c43f commit e4de224

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

lib/utils/audit-error.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const log = require('./log-shim')
2+
const replaceInfo = require('./replace-info.js')
23

34
// print an error or just nothing if the audit report has an error
45
// this is called by the audit command, and by the reify-output util
@@ -24,7 +25,7 @@ const auditError = (npm, report) => {
2425
npm.output(JSON.stringify({
2526
message: error.message,
2627
method: error.method,
27-
uri: error.uri,
28+
uri: replaceInfo(error.uri),
2829
headers: error.headers,
2930
statusCode: error.statusCode,
3031
body,

test/lib/utils/audit-error.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ t.test('error, audit command, json', async t => {
8787
message: 'message',
8888
body: { response: 'body' },
8989
method: 'POST',
90-
uri: 'https://example.com/not/a/registry',
90+
uri: 'https://username:password@example.com/not/a/registry',
9191
headers: {
9292
head: ['ers'],
9393
},
@@ -101,7 +101,7 @@ t.test('error, audit command, json', async t => {
101101
'{\n' +
102102
' "message": "message",\n' +
103103
' "method": "POST",\n' +
104-
' "uri": "https://example.com/not/a/registry",\n' +
104+
' "uri": "https://username:***@example.com/not/a/registry",\n' +
105105
' "headers": {\n' +
106106
' "head": [\n' +
107107
' "ers"\n' +

0 commit comments

Comments
 (0)