Skip to content

Commit 0d05c3f

Browse files
committed
Fix --source and --minionversion to capture single arg, not $*
Changing SOURCE_PARAMS and MINION_VERSION_PARAMS from "$*" to "$1" in the argument parser ensures the validators receive only the user-supplied value, not the full remaining argument list. This allows _validate_source_param to correctly detect spaces in HTTP/S/FTP URLs rather than silently truncating to the first word. Removes the cut workaround from both validator functions since the value is now unambiguous.
1 parent 4fb88a4 commit 0d05c3f

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

linux/svtminion.sh

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1951,8 +1951,7 @@ _install_fn () {
19511951

19521952
_validate_source_param() {
19531953

1954-
local source_val=""
1955-
source_val=$(echo "$1" | cut -d ' ' -f 1)
1954+
local source_val="$1"
19561955

19571956
if [[ -z "${source_val}" ]]; then
19581957
_error_log "$0:${FUNCNAME[0]} Invalid --source: must not be empty"
@@ -2003,8 +2002,7 @@ _validate_source_param() {
20032002

20042003
_validate_minion_version_param() {
20052004

2006-
local version_val=""
2007-
version_val=$(echo "$1" | cut -d ' ' -f 1)
2005+
local version_val="$1"
20082006

20092007
if ! echo "${version_val}" | \
20102008
grep -qE '^(latest|[0-9]{4}(\.[0-9]+(\.[0-9]+)*(rc[0-9]+)?)?)$'; then
@@ -2496,7 +2494,7 @@ while true; do
24962494
-j | --source )
24972495
SOURCE_FLAG=1;
24982496
shift;
2499-
SOURCE_PARAMS="$*";
2497+
SOURCE_PARAMS="$1";
25002498
;;
25012499
-l | --loglevel )
25022500
LOG_LEVEL_FLAG=1;
@@ -2506,7 +2504,7 @@ while true; do
25062504
-m | --minionversion )
25072505
MINION_VERSION_FLAG=1;
25082506
shift;
2509-
MINION_VERSION_PARAMS="$*";
2507+
MINION_VERSION_PARAMS="$1";
25102508
;;
25112509
-n | --reconfig )
25122510
RECONFIG_FLAG=1;

0 commit comments

Comments
 (0)