summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/mattermost/platform/model/command.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2016-06-23 20:28:05 +0200
committerWim <wim@42.be>2016-06-23 20:28:05 +0200
commit6ec77e06eaecc9b0567e1c67e9255da448fa4b2f (patch)
tree9520a787e4b8bbc582fc1fddbf8bedd810f8bd6c /vendor/github.com/mattermost/platform/model/command.go
parente48db67649118bb2c77acfedc9320b45db9fd4ea (diff)
downloadmatterbridge-msglm-6ec77e06eaecc9b0567e1c67e9255da448fa4b2f.tar.gz
matterbridge-msglm-6ec77e06eaecc9b0567e1c67e9255da448fa4b2f.tar.bz2
matterbridge-msglm-6ec77e06eaecc9b0567e1c67e9255da448fa4b2f.zip
Sync with mattermost 3.1.0
Diffstat (limited to 'vendor/github.com/mattermost/platform/model/command.go')
-rw-r--r--vendor/github.com/mattermost/platform/model/command.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/vendor/github.com/mattermost/platform/model/command.go b/vendor/github.com/mattermost/platform/model/command.go
index 4d5f7ace..decb647b 100644
--- a/vendor/github.com/mattermost/platform/model/command.go
+++ b/vendor/github.com/mattermost/platform/model/command.go
@@ -6,11 +6,14 @@ package model
import (
"encoding/json"
"io"
+ "strings"
)
const (
COMMAND_METHOD_POST = "P"
COMMAND_METHOD_GET = "G"
+ MIN_TRIGGER_LENGTH = 1
+ MAX_TRIGGER_LENGTH = 128
)
type Command struct {
@@ -99,7 +102,7 @@ func (o *Command) IsValid() *AppError {
return NewLocAppError("Command.IsValid", "model.command.is_valid.team_id.app_error", nil, "")
}
- if len(o.Trigger) == 0 || len(o.Trigger) > 128 {
+ if len(o.Trigger) < MIN_TRIGGER_LENGTH || len(o.Trigger) > MAX_TRIGGER_LENGTH || strings.Index(o.Trigger, "/") == 0 || strings.Contains(o.Trigger, " ") {
return NewLocAppError("Command.IsValid", "model.command.is_valid.trigger.app_error", nil, "")
}