diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2017-11-22 15:57:46 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2017-11-22 17:56:37 +0100 |
| commit | a7bbe24b6f474dba5ca701413c268fe192e44346 (patch) | |
| tree | 2ac5d54c034a8accd8fe00a8a24eab943a430430 | |
| parent | fc5dca0a4a6b099cc5bc7ad812fc5fa4bf97ea34 (diff) | |
dashboard/app: strip quotes from commit titles
There is probably no way to stop people doing this.
Though, we never mention that this is allowed syntax...
| -rw-r--r-- | dashboard/app/fix_test.go | 2 | ||||
| -rw-r--r-- | dashboard/app/reporting.go | 12 |
2 files changed, 10 insertions, 4 deletions
diff --git a/dashboard/app/fix_test.go b/dashboard/app/fix_test.go index a12674764..23023bb2a 100644 --- a/dashboard/app/fix_test.go +++ b/dashboard/app/fix_test.go @@ -153,7 +153,7 @@ func TestFixedByTwoCommits(t *testing.T) { cmd := &dashapi.BugUpdate{ ID: rep.ID, Status: dashapi.BugStatusOpen, - FixCommits: []string{"bar: prepare for fixing", "foo: fix the crash"}, + FixCommits: []string{"bar: prepare for fixing", "\"foo: fix the crash\""}, } reply := new(dashapi.BugUpdateReply) c.expectOK(c.API(client1, key1, "reporting_update", cmd, reply)) diff --git a/dashboard/app/reporting.go b/dashboard/app/reporting.go index bfb8a02d9..9180c14ad 100644 --- a/dashboard/app/reporting.go +++ b/dashboard/app/reporting.go @@ -253,6 +253,15 @@ func incomingCommand(c context.Context, cmd *dashapi.BugUpdate) (bool, string, e } func incomingCommandImpl(c context.Context, cmd *dashapi.BugUpdate) (bool, string, error) { + for i, com := range cmd.FixCommits { + if len(com) >= 2 && com[0] == '"' && com[len(com)-1] == '"' { + com = com[1 : len(com)-1] + cmd.FixCommits[i] = com + } + if len(com) < 3 { + return false, fmt.Sprintf("bad commit title: %q", com), nil + } + } bug, bugKey, err := findBugByReportingID(c, cmd.ID) if err != nil { return false, internalError, err @@ -421,9 +430,6 @@ func incomingCommandTx(c context.Context, now time.Time, cmd *dashapi.BugUpdate, if !same { commits := make([]string, 0, len(m)) for com := range m { - if len(com) < 3 { - return false, fmt.Sprintf("bad commit title: %q", com), nil - } commits = append(commits, com) } sort.Strings(commits) |
