|
@@ -18,6 +18,7 @@ const (
|
18
|
18
|
|
19
|
19
|
var (
|
20
|
20
|
errInvalidCharacter = errors.New("Invalid character")
|
|
21
|
+ errEmpty = errors.New("String is empty")
|
21
|
22
|
)
|
22
|
23
|
|
23
|
24
|
// Casefold returns a casefolded string, without doing any name or channel character checks.
|
|
@@ -31,6 +32,8 @@ func CasefoldChannel(name string) (string, error) {
|
31
|
32
|
|
32
|
33
|
if err != nil {
|
33
|
34
|
return "", err
|
|
35
|
+ } else if len(lowered) == 0 {
|
|
36
|
+ return "", errEmpty
|
34
|
37
|
}
|
35
|
38
|
|
36
|
39
|
if lowered[0] != '#' {
|
|
@@ -55,6 +58,8 @@ func CasefoldName(name string) (string, error) {
|
55
|
58
|
|
56
|
59
|
if err != nil {
|
57
|
60
|
return "", err
|
|
61
|
+ } else if len(lowered) == 0 {
|
|
62
|
+ return "", errEmpty
|
58
|
63
|
}
|
59
|
64
|
|
60
|
65
|
// space can't be used
|