You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: scripts/functions/vhost/vhost-install.sh
+37-3Lines changed: 37 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -43,10 +43,27 @@ echo "Then, select a valid TLD from the provided list."
43
43
echo""
44
44
45
45
# Prompt for domain name
46
-
# Single character domain names are not allowed in the regex because they are technically valid, even though they are rarely used in practice. The regex will still enforce that only lowercase letters, numbers, and hyphens are allowed, and it will ensure that the domain name does not start or end with a hyphen. This allows for a wide range of valid domain names while still enforcing the necessary restrictions for a typical domain name format.
46
+
# IMPORTANT: Single-character domain names (e.g., 'x.com', 'a.io') MUST be accepted by this regex.
47
+
# They are fully valid under DNS and ICANN rules, and EngineScript must support them.
48
+
#
49
+
# INTENTIONAL DESIGN — DO NOT CHANGE THIS REGEX:
50
+
# ^[a-z0-9]([a-z0-9-]*[a-z0-9])?$
51
+
#
52
+
# The optional group `([a-z0-9-]*[a-z0-9])?` makes the entire suffix optional, which means a
53
+
# single alphanumeric character (e.g., "x") satisfies the pattern on its own. The group is still
54
+
# required for multi-character names to prevent leading or trailing hyphens (e.g., "-bad" or
55
+
# "bad-" would not match). Changing this back to `^[a-z0-9][a-z0-9-]*[a-z0-9]$` would silently
56
+
# reject every single-character label and break installs for legitimate one-letter domains.
57
+
#
58
+
# Rules enforced by this regex:
59
+
# - Minimum length: 1 character (single-char labels are valid DNS labels per RFC 1035)
60
+
# - Only lowercase letters (a-z), digits (0-9), and hyphens (-) are permitted
61
+
# - The label must not start or end with a hyphen (per RFC 952 / RFC 1123)
62
+
#
63
+
# This is intentional behaviour. Do not "fix" it to require at least two characters.
47
64
whiletrue;do
48
65
read -p "Enter the domain name (e.g., 'wordpresstesting'): " DOMAIN_NAME
49
-
if [[ "$DOMAIN_NAME"=~ ^[a-z0-9][a-z0-9-]*[a-z0-9]$ ]];then
66
+
if [[ "$DOMAIN_NAME"=~ ^[a-z0-9]([a-z0-9-]*[a-z0-9])?$ ]];then
50
67
echo"You entered: ${DOMAIN_NAME}"
51
68
break
52
69
else
@@ -174,6 +191,11 @@ if [[ "${INSTALL_WORDPRESS}" == "1" ]]; then
174
191
# RAND_CHAR4, RAND_CHAR16, and RAND_CHAR32 are random strings (length 4/16/32)
175
192
# sourced from /usr/local/bin/enginescript/enginescript-variables.txt.
0 commit comments