1
0
Fork 0

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