Skip to content

Commit 65ee538

Browse files
committed
Sanitise noise from metadata headers file.
Only records lines starting the `X-Sdkman`
1 parent 1d65017 commit 65ee538

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/bash/sdkman-install.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ function __sdkman_install_local_version() {
115115

116116
function __sdkman_download() {
117117
local candidate version archives_folder
118-
local headers_file
118+
local headers_file tmp_headers_file
119119

120120
candidate="$1"
121121
version="$2"
@@ -129,6 +129,7 @@ function __sdkman_download() {
129129
local download_url="${SDKMAN_CANDIDATES_API}/broker/download/${candidate}/${version}/${platform_parameter}"
130130
local base_name="${candidate}-${version}"
131131
local zip_archive_target="${SDKMAN_DIR}/archives/${base_name}.zip"
132+
tmp_headers_file="${SDKMAN_DIR}/tmp/${base_name}.headers.tmp"
132133
headers_file="${metadata_folder}/${base_name}.headers"
133134

134135
# pre-installation hook: implements function __sdkman_pre_installation_hook
@@ -150,7 +151,8 @@ function __sdkman_download() {
150151
echo ""
151152

152153
# download binary
153-
__sdkman_secure_curl_download "${download_url}" --output "${binary_input}" --dump-header "${headers_file}"
154+
__sdkman_secure_curl_download "${download_url}" --output "${binary_input}" --dump-header "${tmp_headers_file}"
155+
grep '^X-Sdkman' "${tmp_headers_file}" > "${headers_file}"
154156
__sdkman_echo_debug "Downloaded binary to: ${binary_input} (HTTP headers written to: ${headers_file})"
155157

156158
# post-installation hook: implements function __sdkman_post_installation_hook

0 commit comments

Comments
 (0)