fix: Validate that all application names are valid domain names
Invalid application names will need to be manually cleaned up by the user, and as such this is a bc-break. Closes #3054
This commit is contained in:
@@ -141,11 +141,14 @@ is_valid_app_name() {
|
||||
declare desc="verify app name format"
|
||||
local APP="$1"
|
||||
[[ ! -n "$APP" ]] && dokku_log_fail "APP must not be null"
|
||||
if [[ ! "$APP" =~ ^[a-z].* && ! "$APP" =~ ^[0-9].* ]]; then
|
||||
[[ -d "$DOKKU_ROOT/$APP" ]] && rm -rf "${DOKKU_ROOT:?}/$APP"
|
||||
dokku_log_fail "App name must begin with lowercase alphanumeric character"
|
||||
if [[ "$APP" =~ ^[a-z].* ]] || [[ "$APP" =~ ^[0-9].* ]]; then
|
||||
if [[ ! $APP =~ [A-Z] ]] && [[ ! $APP =~ [:] ]]; then
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
|
||||
[[ -d "$DOKKU_ROOT/$APP" ]] && rm -rf "${DOKKU_ROOT:?}/$APP"
|
||||
dokku_log_fail "App name must begin with lowercase alphanumeric character"
|
||||
}
|
||||
|
||||
verify_app_name() {
|
||||
|
||||
Reference in New Issue
Block a user