Skip to content

Commit 5eceac2

Browse files
authored
Merge pull request #464 from tfutils/fix/454-unquoted-netrc-opt
Fix #454: Unquoted curl options in curlw() break on paths with spaces
2 parents b9f50bc + b69788a commit 5eceac2

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

lib/helpers.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,19 @@ fi;
6565

6666
# Curl wrapper to switch TLS option for each OS
6767
function curlw () {
68-
local TLS_OPT="--tlsv1.2";
68+
local -a tls_opt=(--tlsv1.2);
6969

7070
# Check if curl is 10.12.6 or above
7171
if [[ -n "$(command -v sw_vers 2>/dev/null)" && ("$(sw_vers)" =~ 10\.12\.([6-9]|[0-9]{2}) || "$(sw_vers)" =~ 10\.1[3-9]) ]]; then
72-
TLS_OPT="";
72+
tls_opt=();
7373
fi;
7474

75+
local -a netrc_opt=();
7576
if [[ ! -z "${TFENV_NETRC_PATH:-""}" ]]; then
76-
NETRC_OPT="--netrc-file ${TFENV_NETRC_PATH}";
77-
else
78-
NETRC_OPT="";
77+
netrc_opt=(--netrc-file "${TFENV_NETRC_PATH}");
7978
fi;
8079

81-
curl ${TLS_OPT} ${NETRC_OPT} "$@";
80+
curl ${tls_opt[@]+"${tls_opt[@]}"} ${netrc_opt[@]+"${netrc_opt[@]}"} "$@";
8281
};
8382
export -f curlw;
8483

0 commit comments

Comments
 (0)