Skip to content

Commit

Permalink
Allow - and _ in canastaID (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
naresh-kumar-babu authored Sep 10, 2024
1 parent 9ccbf42 commit 4eb09de
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func NewCmdCreate() *cobra.Command {
if canastaInfo, err = canasta.GeneratePasswords(path, canastaInfo); err != nil {
log.Fatal(err)
}
validString := regexp.MustCompile(`^[a-zA-Z0-9]+$`)
validString := regexp.MustCompile(`^[a-zA-Z0-9]([a-zA-Z0-9-_]*[a-zA-Z0-9])?$`)

if !validString.MatchString(canastaInfo.Id) {
log.Fatal(fmt.Errorf("Error: CanastaID should not contain spaces or non-ASCII characters, only alphanumeric characters are allowed"))
Expand Down

0 comments on commit 4eb09de

Please sign in to comment.