Skip to content

🐛 fix: better number type setting check #439

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
🐛 fix: better number type setting check
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
  • Loading branch information
mhkarimi1383 authored Apr 13, 2024
commit 9d417ab46371eddca62b7d356fad5275e5bf8328
25 changes: 16 additions & 9 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down