Skip to content

Commit

Permalink
stricter validation (hestiacp#4586)
Browse files Browse the repository at this point in the history
* stricter validation

reject nonsense quotas like "0%" and "09%" and "199%"

mostly just a nitpick

* oops forgot a line

* Update main.sh
  • Loading branch information
divinity76 authored Oct 7, 2024
1 parent 6038f82 commit 3f99e48
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions func/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1161,8 +1161,9 @@ is_cron_format_valid() {

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

Expand Down

0 comments on commit 3f99e48

Please sign in to comment.