Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions internal/i18n/en_translations.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,4 +205,5 @@ var (
MsgInvalidIdentity = ffm("FF10285", "Supplied Fabric signer identity is invalid", 400)
MsgFailedToDecodeCertificate = ffm("FF10286", "Failed to decode certificate: %s", 500)
MsgInvalidMessageType = ffm("FF10287", "Invalid message type - allowed types are %s", 400)
MsgNoUUID = ffm("FF10288", "Field '%s' must not be a UUID", 400)
)
4 changes: 4 additions & 0 deletions pkg/fftypes/validations.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ func ValidateFFNameField(ctx context.Context, str string, fieldName string) erro
if !ffNameValidator.MatchString(str) {
return i18n.NewError(ctx, i18n.MsgInvalidName, fieldName)
}
if _, err := ParseUUID(ctx, str); err == nil {
// Name must not be a UUID
return i18n.NewError(ctx, i18n.MsgNoUUID, fieldName)
}
return nil
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/fftypes/validations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ func TestValidateFFNameField(t *testing.T) {
err = ValidateFFNameField(context.Background(), "0123456789_123456789-123456789.123456789-123456789_12345678901234", "badField")
assert.Regexp(t, "FF10131.*badField", err)

err = ValidateFFNameField(context.Background(), "af34658e-a728-4b21-b9cf-8451f07be065", "badField")
assert.Regexp(t, "FF10288.*badField", err)

}

func TestValidateLength(t *testing.T) {
Expand Down