From 5b5bc4a65d261b0d1128d206f0b887f722d6f65e Mon Sep 17 00:00:00 2001 From: Adam Shannon Date: Wed, 24 Apr 2019 22:03:32 -0500 Subject: [PATCH] controllers: allow numeric characters in data objects for accounts and transactions --- controllers/accounts.go | 2 +- controllers/transactions.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/accounts.go b/controllers/accounts.go index cec4c5a..1ef451e 100644 --- a/controllers/accounts.go +++ b/controllers/accounts.go @@ -64,7 +64,7 @@ func unmarshalToAccount(r *http.Request, account *models.Account) error { if err != nil { return err } - var validKey = regexp.MustCompile(`^[a-z_A-Z]+$`) + var validKey = regexp.MustCompile(`^[a-z_A-Z0-9]+$`) for key := range account.Data { if !validKey.MatchString(key) { return fmt.Errorf("Invalid key in data json: %v", key) diff --git a/controllers/transactions.go b/controllers/transactions.go index 2d3fb5e..34e39ce 100644 --- a/controllers/transactions.go +++ b/controllers/transactions.go @@ -23,7 +23,7 @@ func unmarshalToTransaction(r *http.Request, txn *models.Transaction) error { if err != nil { return err } - var validKey = regexp.MustCompile(`^[a-z_A-Z]+$`) + var validKey = regexp.MustCompile(`^[a-z_A-Z0-9]+$`) for key := range txn.Data { if !validKey.MatchString(key) { return fmt.Errorf("Invalid key in data json: %v", key)