Browse Source

Length check the ownerRepo array

pull/12/head
Kegan Dougal 8 years ago
parent
commit
b89c3ef776
  1. 7
      src/github.com/matrix-org/go-neb/services/github/github.go

7
src/github.com/matrix-org/go-neb/services/github/github.go

@ -63,6 +63,12 @@ func (s *githubService) Plugin(roomID string) plugin.Plugin {
desc *string
)
ownerRepo = args[0]
o := strings.Split(ownerRepo, "/")
if len(o) != 2 {
return &matrix.TextMessage{"m.notice",
`Usage: !github create owner/repo "issue title" "description"`}, nil
}
if len(args) == 2 {
title = &args[1]
} else if len(args) == 3 {
@ -72,7 +78,6 @@ func (s *githubService) Plugin(roomID string) plugin.Plugin {
joinedTitle := strings.Join(args[1:], " ")
title = &joinedTitle
}
o := strings.Split(ownerRepo, "/")
issue, res, err := cli.Issues.Create(o[0], o[1], &github.IssueRequest{
Title: title,

Loading…
Cancel
Save