From 65ee538d57f227577e16fe698be98d004669f7ea Mon Sep 17 00:00:00 2001 From: Marco Vermeulen Date: Sun, 20 Feb 2022 18:30:31 +0000 Subject: [PATCH] Sanitise noise from metadata headers file. Only records lines starting the `X-Sdkman` --- src/main/bash/sdkman-install.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/bash/sdkman-install.sh b/src/main/bash/sdkman-install.sh index 7b99232e..447464aa 100644 --- a/src/main/bash/sdkman-install.sh +++ b/src/main/bash/sdkman-install.sh @@ -115,7 +115,7 @@ function __sdkman_install_local_version() { function __sdkman_download() { local candidate version archives_folder - local headers_file + local headers_file tmp_headers_file candidate="$1" version="$2" @@ -129,6 +129,7 @@ function __sdkman_download() { local download_url="${SDKMAN_CANDIDATES_API}/broker/download/${candidate}/${version}/${platform_parameter}" local base_name="${candidate}-${version}" local zip_archive_target="${SDKMAN_DIR}/archives/${base_name}.zip" + tmp_headers_file="${SDKMAN_DIR}/tmp/${base_name}.headers.tmp" headers_file="${metadata_folder}/${base_name}.headers" # pre-installation hook: implements function __sdkman_pre_installation_hook @@ -150,7 +151,8 @@ function __sdkman_download() { echo "" # download binary - __sdkman_secure_curl_download "${download_url}" --output "${binary_input}" --dump-header "${headers_file}" + __sdkman_secure_curl_download "${download_url}" --output "${binary_input}" --dump-header "${tmp_headers_file}" + grep '^X-Sdkman' "${tmp_headers_file}" > "${headers_file}" __sdkman_echo_debug "Downloaded binary to: ${binary_input} (HTTP headers written to: ${headers_file})" # post-installation hook: implements function __sdkman_post_installation_hook