Skip to content

Commit d5a55bb

Browse files
authored
Merge pull request #29 from JankariTech/fix/allow-new-wp-id
fix: allow new and old work package id patterns
2 parents 17e740b + 78eacae commit d5a55bb

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎cmd/tmetric.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"errors"
2222
"fmt"
2323
"os"
24-
"strconv"
24+
"regexp"
2525
"strings"
2626
"time"
2727

@@ -34,8 +34,8 @@ import (
3434

3535
func validateOpenProjectWorkPackage(input string) error {
3636
if len(input) > 0 {
37-
_, err := strconv.ParseInt(input, 10, 32)
38-
if err != nil {
37+
matched, err := regexp.MatchString(`^[a-zA-Z0-9-]+$`, input)
38+
if err != nil || !matched {
3939
return errors.New("Invalid WP")
4040
}
4141
}

0 commit comments

Comments
 (0)