mirror of
https://github.com/adnanh/webhook.git
synced 2026-07-26 17:19:17 +08:00
Only support unsigned ints for slice indexes
This commit changes ExtractParameter to parse slice indexes as unsigned ints. Fixes test case "a.-1.b".
This commit is contained in:
+1
-1
@@ -44,7 +44,7 @@ func ExtractParameter(s string, params interface{}) (string, bool) {
|
|||||||
if paramsValueSliceLength := paramsValue.Len(); paramsValueSliceLength > 0 {
|
if paramsValueSliceLength := paramsValue.Len(); paramsValueSliceLength > 0 {
|
||||||
|
|
||||||
if p := strings.SplitN(s, ".", 2); len(p) > 1 {
|
if p := strings.SplitN(s, ".", 2); len(p) > 1 {
|
||||||
index, err := strconv.ParseInt(p[0], 10, 64)
|
index, err := strconv.ParseUint(p[0], 10, 64)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", false
|
return "", false
|
||||||
|
|||||||
Reference in New Issue
Block a user