diff options
author | Vincent Ambo <mail@tazj.in> | 2021-12-06T17·03+0300 |
---|---|---|
committer | tazjin <mail@tazj.in> | 2021-12-07T18·27+0000 |
commit | 8a944484f0d28bc372ead0842780fe697f997f5e (patch) | |
tree | 8bd382a4b106a5910446d4498327dd973cc37db8 | |
parent | 6faf0edaff463fd1195e2d5642252a34ea17481a (diff) |
fix(ops/besadii): Unquote Gerrit's extra-quotes around emails r/3149
Gerrit wraps RFC5322 emails in another layer of quotes when passing them as flags, and this needs to be unquoted. Otherwise hook invocations fail with cryptic errors. Change-Id: Ieeb74c662873d99a4154f8cbc92da77b039cb88e
-rw-r--r-- | ops/besadii/main.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/ops/besadii/main.go b/ops/besadii/main.go index 7c1626c7450e..b31d3e426ae3 100644 --- a/ops/besadii/main.go +++ b/ops/besadii/main.go @@ -297,6 +297,12 @@ func ignoreFlags(ignore []string) { // Extract the username & email from Gerrit's uploader flag and set it // on the trigger struct, for display in Buildkite. func extractChangeUploader(uploader string, trigger *buildTrigger) error { + // Gerrit passes the uploader in another extra layer of quotes. + uploader, err := strconv.Unquote(uploader) + if err != nil { + return fmt.Errorf("failed to unquote email - forgot quotes on manual invocation?: %w", err) + } + // Extract the uploader username & email from the input passed by // Gerrit (in RFC 5322 format). addr, err := mail.ParseAddress(uploader) |