mirror of
https://github.com/golang/go
synced 2024-11-18 17:54:57 -07:00
dashboard/builder: fix crash on commits that contain ESC symbol
Currently performance builders crash with: hg log: unmarshal Mercurial log: XML syntax error on line 4991: illegal character code U+001B R=adg CC=golang-codereviews https://golang.org/cl/110060046
This commit is contained in:
parent
95a7aeb192
commit
b96847cb92
@ -5,6 +5,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"os"
|
||||
@ -127,6 +128,10 @@ func (r *Repo) Log() ([]HgLog, error) {
|
||||
return err
|
||||
}
|
||||
|
||||
// We have a commit with description that contains 0x1b byte.
|
||||
// Mercurial does not escape it, but xml.Unmarshal does not accept it.
|
||||
data = bytes.Replace(data, []byte{0x1b}, []byte{'?'}, -1)
|
||||
|
||||
err = xml.Unmarshal([]byte("<Top>"+string(data)+"</Top>"), &logStruct)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unmarshal %s log: %v", r.Master.VCS, err)
|
||||
|
Loading…
Reference in New Issue
Block a user