9
9
function checkBucket() {
10
10
# check length of bucket name
11
11
if [[ ${# 1} -lt 3 || ${# 1} -gt 63 ]]; then
12
- echo " ::error::Bucket name must be between 3 and 63 characters long."
12
+ echo " ::error::Bucket name ' $1 ' must be between 3 and 63 characters long."
13
13
exit 1
14
14
fi
15
15
16
16
# check that bucket name consists only of lowercase letters, numbers, dots (.), and hyphens (-)
17
17
if [[ ! $1 =~ ^[a-z0-9.-]+$ ]]; then
18
- echo " ::error::Bucket name can only consist of lowercase letters, numbers, dots (.), and hyphens (-)."
18
+ echo " ::error::Bucket name ' $1 ' can only consist of lowercase letters, numbers, dots (.), and hyphens (-)."
19
19
exit 1
20
20
fi
21
21
22
22
# check that bucket name begins and ends with a letter or number
23
23
if [[ ! $1 =~ ^[a-zA-Z0-9] ]]; then
24
- echo " ::error::Bucket name must begin with a letter or number."
24
+ echo " ::error::Bucket name ' $1 ' must begin with a letter or number."
25
25
exit 1
26
26
fi
27
27
if [[ ! $1 =~ [a-zA-Z0-9]$ ]]; then
28
- echo " ::error::Bucket name must end with a letter or number."
28
+ echo " ::error::Bucket name ' $1 ' must end with a letter or number."
29
29
exit 1
30
30
fi
31
31
32
32
# check that bucket name does not contain two adjacent periods
33
33
if [[ $1 =~ \.\. ]]; then
34
- echo " ::error::Bucket name cannot contain two adjacent periods."
34
+ echo " ::error::Bucket name ' $1 ' cannot contain two adjacent periods."
35
35
exit 1
36
36
fi
37
37
38
38
# check that bucket name is not formatted as an IP address
39
39
if [[ $1 =~ ^[0-9]{1,3}\. [0-9]{1,3}\. [0-9]{1,3}\. [0-9]{1,3}$ ]]; then
40
- echo " ::error::Bucket name cannot be formatted as an IP address."
40
+ echo " ::error::Bucket name ' $1 ' cannot be formatted as an IP address."
41
41
exit 1
42
42
fi
43
43
44
44
# check that bucket name does not start with the prefix xn--
45
45
if [[ $1 =~ ^xn-- ]]; then
46
- echo " ::error::Bucket name cannot start with the prefix xn--."
46
+ echo " ::error::Bucket name ' $1 ' cannot start with the prefix xn--."
47
47
exit 1
48
48
fi
49
49
50
50
# check that bucket name does not end with the suffix -s3alias
51
51
if [[ $1 =~ -s 3alias$ ]]; then
52
- echo " ::error::Bucket name cannot end with the suffix -s3alias."
52
+ echo " ::error::Bucket name ' $1 ' cannot end with the suffix -s3alias."
53
53
exit 1
54
54
fi
55
55
}
56
56
57
- checkBucket $1
57
+ checkBucket $1
0 commit comments