Skip to content

Commit 3f99e48

Browse files
authored
stricter validation (hestiacp#4586)
* stricter validation reject nonsense quotas like "0%" and "09%" and "199%" mostly just a nitpick * oops forgot a line * Update main.sh
1 parent 6038f82 commit 3f99e48

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

func/main.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,8 +1161,9 @@ is_cron_format_valid() {
11611161

11621162
# Validate CPU Quota:
11631163
is_valid_cpu_quota() {
1164-
if [[ ! "$1" =~ ^[0-9]+%$ ]]; then
1165-
check_result "$E_INVALID" "Invalid CPU Quota format :: $1"
1164+
local cpu_quota="$1"
1165+
if [[ ! "$cpu_quota" =~ ^[1-9][0-9]*%$ ]]; then
1166+
check_result "$E_INVALID" "Invalid CPU Quota format: $cpu_quota"
11661167
fi
11671168
}
11681169

0 commit comments

Comments
 (0)