From 9d417ab46371eddca62b7d356fad5275e5bf8328 Mon Sep 17 00:00:00 2001 From: Muhammed Hussein karimi Date: Sat, 13 Apr 2024 14:57:20 +0330 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20better=20number=20type=20?= =?UTF-8?q?setting=20check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit before this, if you have string value but starting with number it will act as a number, So I added a better checking method for that to test that you can run: ```bash case "6a6" in ''|*[!0-9]*) echo false; ;; esac case "66" in ''|*[!0-9]*) echo false; ;; esac ``` second one will be false and we will use it as a number --- entrypoint.sh | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index d4edd75f37..a4c4a21991 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -86,19 +86,26 @@ setConfigurationValue() { local TYPE="$4" if [ -z "$TYPE" ]; then case "$2" in - [Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee]|[Nn]one) - TYPE="bool" - ;; - [1-9][0-9]*) - TYPE="integer" - ;; - [\[\(]*[\]\)]) - TYPE="array" + ''|*[!0-9]*) + TYPE="not-integer" ;; *) - TYPE="string" + TYPE="integer" ;; esac + if [ "$TYPE" != "integer" ]; then + case "$2" in + [Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee]|[Nn]one) + TYPE="bool" + ;; + [\[\(]*[\]\)]) + TYPE="array" + ;; + *) + TYPE="string" + ;; + esac + fi fi case "$TYPE" in emptyreturn)