download_and_compile.sh: take username verbatim (no conversion to lowercase)

Fix for commit 8a7fd33b2b: in argument to --git-clone-site-params,
take the username exactly as provided instead of converting it to
lowercase (the site and protocol are still converted to lowercase, but
*that* is intentional).
This commit is contained in:
Florent Rougon 2018-09-26 09:27:53 +02:00
parent a281b46214
commit 2930727a87

View File

@ -417,14 +417,15 @@ while true; do
shift 2
;;
--git-clone-site-params)
# Convert the argument to lowercase, then match it against the regexp
if [[ "${2,,}" =~ ^([[:alnum:]]+)=([[:alpha:]]+)(:([[:alnum:]]+))?$ ]]; then
site="${BASH_REMATCH[1]}"
proto="${BASH_REMATCH[2]}"
username="${BASH_REMATCH[4]}"
if [[ "$2" =~ ^([[:alnum:]]+)=([[:alpha:]]+)(:([[:alnum:]]+))?$ ]]; then
site="${BASH_REMATCH[1],,}" # convert the site to lowercase
proto="${BASH_REMATCH[2],,}" # ditto for the protocol
verbatim_proto="${BASH_REMATCH[2]}"
username="${BASH_REMATCH[4]}" # but take the username verbatim
if ! _elementIn "$proto" ssh https git; then
echo "Invalid protocol passed to option --git-clone-site-params:" \
"'$proto'." >&2
"'$verbatim_proto'." >&2
echo "Allowed protocols are 'ssh', 'https' and 'git'." >&2
exit 1
fi
@ -441,7 +442,7 @@ while true; do
exit 1
fi
unset -v site proto username
unset -v site proto verbatim_proto username
else
echo "Invalid value passed to option --git-clone-site-params: '$2'." >&2
echo "The correct syntax is" \