Skip to content

Commit f06f9c7

Browse files
committed
Fix bug which considered '#' and '*' as invalid
input for gather
1 parent ca64eb3 commit f06f9c7

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

request.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
// RequestValues hold form values from a validated Request
1919
type RequestValues map[string]string
2020

21-
// CallDuration Parses the duration rom the string value
21+
// CallDuration Parses the duration from the string value
2222
func (r RequestValues) CallDuration() (int, error) {
2323
var duration int
2424
if r["CallDuration"] != "" {
@@ -156,5 +156,5 @@ var fieldValidators = map[string]valCfg{
156156
// "SipUsername": "SipUsername",
157157
// "SipCallId": "SipCallId",
158158
// "SipSourceIp": "SipSourceIp",
159-
"Digits": valCfg{valFunc: validNumeric},
159+
"Digits": valCfg{valFunc: validateKeyPadEntry},
160160
}

validators.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func validatePhoneNumber(num string) error {
4444
return nil
4545
}
4646

47-
func validNumeric(v interface{}, param string) error {
47+
func validateKeyPadEntry(v interface{}, param string) error {
4848
switch num := v.(type) {
4949
case string:
5050
if num == "" {
@@ -53,22 +53,22 @@ func validNumeric(v interface{}, param string) error {
5353
}
5454
return errors.New("Required")
5555
}
56-
return validateNumeric(num)
56+
return validateNumericPoundStar(num)
5757
case *string:
5858
if num == nil {
5959
if param == "allowempty" {
6060
return nil
6161
}
6262
return errors.New("Required")
6363
}
64-
return validateNumeric(*num)
64+
return validateNumericPoundStar(*num)
6565
default:
6666
return fmt.Errorf("validDatastoreKey: Unexpected type %T", num)
6767
}
6868
}
6969

70-
func validateNumeric(v string) error {
71-
return characterList(v, "0123456789")
70+
func validateNumericPoundStar(v string) error {
71+
return characterList(v, "0123456789#*")
7272
}
7373

7474
// characterList checks a string against a list of acceptable characters.

0 commit comments

Comments
 (0)