File tree 1 file changed +10
-1
lines changed
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 1
1
package summary
2
2
3
3
import (
4
+ "bytes"
4
5
"context"
5
6
"encoding/base64"
6
7
"errors"
@@ -11,6 +12,7 @@ import (
11
12
"strconv"
12
13
"strings"
13
14
"time"
15
+ "unicode/utf8"
14
16
15
17
"github.com/google/uuid"
16
18
"google.golang.org/api/iterator"
@@ -183,13 +185,20 @@ func (s Summarizer) handleBuildProgress(progress *bes.Progress) {
183
185
if _ , exists := uniqueLines [line ]; ! exists {
184
186
uniqueLines [line ] = struct {}{}
185
187
if line != "" && line != "\n " {
186
- s .summary .BuildLogs .WriteString (line + "\n " )
188
+ if utf8 .ValidString (line ) {
189
+ s .summary .BuildLogs .WriteString (sanitizeUTF8 (line ) + "\n " )
190
+ }
187
191
}
188
192
}
189
193
}
190
194
}
191
195
}
192
196
197
+ func sanitizeUTF8 (s string ) string {
198
+ bs := bytes .ReplaceAll ([]byte (s ), []byte {0 }, []byte {})
199
+ return strings .ToValidUTF8 (string (bs ), "?" )
200
+ }
201
+
193
202
// handleStarted
194
203
func (s Summarizer ) handleStarted (started * bes.BuildStarted ) {
195
204
var startedAt time.Time
You can’t perform that action at this time.
0 commit comments