diff --git a/bin/n b/bin/n index 67157f2..44daebf 100755 --- a/bin/n +++ b/bin/n @@ -197,6 +197,10 @@ display_major_version() { echo "${version}" } +display_masked_url() { + echo "$1" | sed -r 's/(https?:\/\/[^:]+):([^@]+)@/\1:****@/' +} + # # Synopsis: update_mirror_settings_for_version version # e.g. means using download mirror and folder is nightly @@ -793,7 +797,7 @@ install() { log installing "${g_mirror_folder_name}-v$version" local url="$(tarball_url "$version")" - is_ok "${url}" || abort "download preflight failed for '$version' (${url})" + is_ok "${url}" || abort "download preflight failed for '$version' ($(display_masked_url "${url}"))" log mkdir "$dir" mkdir -p "$dir" || abort "sudo required (or change ownership, or define N_PREFIX)" @@ -801,7 +805,7 @@ install() { cd "${dir}" || abort "Failed to cd to ${dir}" - log fetch "$url" + log fetch "$(display_masked_url "${url}")" do_get "${url}" | tar "$tarflag" --strip-components=1 --no-same-owner -f - pipe_results=( "${PIPESTATUS[@]}" ) if [[ "${pipe_results[0]}" -ne 0 ]]; then @@ -1241,7 +1245,7 @@ display_remote_index() { do_get_index "${index_url}" | tail -n +2 | cut -f 1,3,10 if [[ "${PIPESTATUS[0]}" -ne 0 ]]; then # Reminder: abort will only exit subshell, but consistent error display - abort "failed to download version index (${index_url})" + abort "failed to download version index ($(display_masked_url "${index_url}"))" fi } @@ -1494,8 +1498,8 @@ function show_diagnostics() { printf "\n\nSETTINGS\n" printf "\nn\n" - echo "node mirror: ${N_NODE_MIRROR}" - echo "node downloads mirror: ${N_NODE_DOWNLOAD_MIRROR}" + echo "node mirror: $(display_masked_url "${N_NODE_MIRROR}")" + echo "node downloads mirror: $(display_masked_url "${N_NODE_DOWNLOAD_MIRROR}")" echo "install destination: ${N_PREFIX}" [[ -n "${N_PREFIX}" ]] && echo "PATH: ${PATH}" echo "ls-remote max matches: ${N_MAX_REMOTE_MATCHES}"