mirror of
https://github.com/tj/n.git
synced 2024-11-21 18:48:57 +01:00
mask download url when there is a password (#815)
This commit is contained in:
parent
6051073a6a
commit
cf40ac5e0a
14
bin/n
14
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. <nightly/latest> 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}"
|
||||
|
Loading…
Reference in New Issue
Block a user