diff --git a/lib/utils/display.js b/lib/utils/display.js index 67a3b98c0417a..a90d891b3cd4a 100644 --- a/lib/utils/display.js +++ b/lib/utils/display.js @@ -259,7 +259,11 @@ class Display { // Write formatted and (non-)colorized output to streams #write (stream, options, ...args) { const colors = stream === this.#stdout ? this.#stdoutColor : this.#stderrColor - const value = formatWithOptions({ colors, ...options }, ...args) + const skipRedact = args.length > 0 ? args[args.length - 1]?.skipRedact : false + if (skipRedact) { + args = args.slice(0, args.length - 1) + } + const value = formatWithOptions({ colors, ...options, skipRedact }, ...args) this.#progress.write(() => stream.write(value)) } diff --git a/lib/utils/format.js b/lib/utils/format.js index 9216c7918678a..5bb06605ed28d 100644 --- a/lib/utils/format.js +++ b/lib/utils/format.js @@ -41,9 +41,12 @@ function STRIP_C01 (str) { return result } -const formatWithOptions = ({ prefix: prefixes = [], eol = '\n', ...options }, ...args) => { +const formatWithOptions = ({ prefix: prefixes = [], eol = '\n', skipRedact = false, ...options }, ...args) => { const prefix = prefixes.filter(p => p != null).join(' ') - const formatted = redactLog(STRIP_C01(baseFormatWithOptions(options, ...args))) + let formatted = STRIP_C01(baseFormatWithOptions(options, ...args)) + if (!skipRedact) { + formatted = redactLog(formatted) + } // Splitting could be changed to only `\n` once we are sure we only emit unix newlines. // The eol param to this function will put the correct newlines in place for the returned string. const lines = formatted.split(/\r?\n/) diff --git a/lib/utils/open-url.js b/lib/utils/open-url.js index 632dcc79949d6..627d3c797f3fd 100644 --- a/lib/utils/open-url.js +++ b/lib/utils/open-url.js @@ -16,9 +16,9 @@ const assertValidUrl = (url) => { const outputMsg = (json, title, url) => { if (json) { - output.buffer({ title, url }) + output.buffer({ title, url }, { skipRedact: true }) } else { - output.standard(`${title}:\n${url}`) + output.standard(`${title}:\n${url}`, { skipRedact: true }) } }