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: clean uri from audit error #6220

Merged
merged 1 commit into from Mar 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/utils/audit-error.js
@@ -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
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