From debd108ac557db24a9c795139dd66efc0dd57edb Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Fri, 6 Jul 2018 11:21:35 +0100 Subject: [PATCH] Fix error messages and incorrect test --- .../matrix-org/dendrite/clientapi/routing/register.go | 6 +++--- .../matrix-org/dendrite/clientapi/routing/register_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/github.com/matrix-org/dendrite/clientapi/routing/register.go b/src/github.com/matrix-org/dendrite/clientapi/routing/register.go index 36bcadbc0..76a696f93 100644 --- a/src/github.com/matrix-org/dendrite/clientapi/routing/register.go +++ b/src/github.com/matrix-org/dendrite/clientapi/routing/register.go @@ -187,12 +187,12 @@ func validateUsername(username string) *util.JSONResponse { } else if !validUsernameRegex.MatchString(username) { return &util.JSONResponse{ Code: http.StatusBadRequest, - JSON: jsonerror.InvalidUsername("User ID can only contain characters a-z, 0-9, or '_-./'"), + JSON: jsonerror.InvalidUsername("Username can only contain characters a-z, 0-9, or '_-./'"), } } else if username[0] == '_' { // Regex checks its not a zero length string return &util.JSONResponse{ Code: http.StatusBadRequest, - JSON: jsonerror.InvalidUsername("User ID cannot start with a '_'"), + JSON: jsonerror.InvalidUsername("Username cannot start with a '_'"), } } return nil @@ -208,7 +208,7 @@ func validateApplicationServiceUsername(username string) *util.JSONResponse { } else if !validUsernameRegex.MatchString(username) { return &util.JSONResponse{ Code: http.StatusBadRequest, - JSON: jsonerror.InvalidUsername("User ID can only contain characters a-z, 0-9, or '_-./'"), + JSON: jsonerror.InvalidUsername("Username can only contain characters a-z, 0-9, or '_-./'"), } } return nil diff --git a/src/github.com/matrix-org/dendrite/clientapi/routing/register_test.go b/src/github.com/matrix-org/dendrite/clientapi/routing/register_test.go index 3e1a3c5fc..fbf140c22 100644 --- a/src/github.com/matrix-org/dendrite/clientapi/routing/register_test.go +++ b/src/github.com/matrix-org/dendrite/clientapi/routing/register_test.go @@ -168,7 +168,7 @@ func TestValidationOfApplicationServices(t *testing.T) { // Create a fake application service fakeID := "FakeAS" - fakeSenderLocalpart := "@_appservice_bot" + fakeSenderLocalpart := "_appservice_bot" fakeApplicationService := config.ApplicationService{ ID: fakeID, URL: "null",