Commit 7b87548e by Nicolas Capens Committed by Nicolas Capens

Regres: Limit the Gerrit comment message length

This prevents '400 Bad Request' responses. The limit of 16000 was determined through experimentation. Bug: b/150284316 Change-Id: I5507efdcfbaac2c09c2dffde9bf173f4f9219a72 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/44989Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAntonio Maiorano <amaiorano@google.com>
parent 2dd86447
...@@ -371,6 +371,13 @@ func (r *regres) run() error { ...@@ -371,6 +371,13 @@ func (r *regres) run() error {
// already got a test result. // already got a test result.
msg = reportHeader + "\n\n" + msg msg = reportHeader + "\n\n" + msg
// Limit the message length to prevent '400 Bad Request' response.
maxMsgLength := 16000
if len(msg) > maxMsgLength {
trunc := " [truncated]\n"
msg = msg[0:maxMsgLength-len(trunc)] + trunc
}
if r.dryRun { if r.dryRun {
log.Printf("DRY RUN: add review to change '%v':\n%v\n", change.id, msg) log.Printf("DRY RUN: add review to change '%v':\n%v\n", change.id, msg)
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment