MCPcopy Index your code
hub / github.com/bootdotdev/bootdev / trimIncompleteUTF8

Function trimIncompleteUTF8

checks/http.go:233–242  ·  view source on GitHub ↗
(b []byte)

Source from the content-addressed store, hash-verified

231}
232
233func trimIncompleteUTF8(b []byte) []byte {
234 for i := 0; i < 3 && len(b) > 0; i++ {
235 r, size := utf8.DecodeLastRune(b)
236 if r != utf8.RuneError || size != 1 {
237 break
238 }
239 b = b[:len(b)-1]
240 }
241 return b
242}

Callers 2

truncateAndStringifyBodyFunction · 0.85
likelyBinaryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected