Skip to content

Commit

Permalink
Sanitise noise from metadata headers file.
Browse files Browse the repository at this point in the history
Only records lines starting the `X-Sdkman`
  • Loading branch information
marc0der committed Feb 22, 2022
1 parent 1d65017 commit 65ee538
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/bash/sdkman-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 65ee538

Please sign in to comment.