From fd0c6a3deaae1820ade8e08678009094ae050ddc Mon Sep 17 00:00:00 2001 From: Denis Arh Date: Mon, 9 Sep 2019 03:13:56 +0200 Subject: [PATCH] Extra channel type-check on creation --- messaging/service/channel.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/messaging/service/channel.go b/messaging/service/channel.go index bb7ef5de9..151c068ff 100644 --- a/messaging/service/channel.go +++ b/messaging/service/channel.go @@ -233,6 +233,10 @@ func (svc *channel) FindMembers(channelID uint64) (out types.ChannelMemberSet, e } func (svc *channel) Create(in *types.Channel) (out *types.Channel, err error) { + if !in.Type.IsValid() { + return nil, errors.Errorf("invalid channel type") + } + if len(in.Name) == 0 && in.Type != types.ChannelTypeGroup { return nil, errors.New("channel name not provided") }