Skip to content

Commit

Permalink
fix: stop crashing when reading malformed slash command
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuixz committed Aug 13, 2024
1 parent 2329f6e commit 4f79056
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/slack/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,14 @@ func (a *App) messageLoop(ctx context.Context, client *socketmode.Client) {
if data.Command != "/"+a.commandName {
client.Ack(*e.Request, map[string]interface{}{
"text": fmt.Sprintf("Unknown command '%s'\n", data.Command)})
return
continue
}

args := strings.Split(data.Text, " ")
if len(args) < 2 {
client.Ack(*e.Request, map[string]interface{}{
"text": fmt.Sprintf("Please specify subcommand and repo")})
return
continue
}

repo := args[1]
Expand All @@ -216,7 +216,7 @@ func (a *App) messageLoop(ctx context.Context, client *socketmode.Client) {
client.Ack(*e.Request, map[string]interface{}{
"text": fmt.Sprintf("Invalid repo '%s'\n", repo),
})
return
continue
}

switch subcommand {
Expand Down

0 comments on commit 4f79056

Please sign in to comment.