fix: actually test httpapi.WebsocketCloseSprintf (#6261)

This commit is contained in:
Colin Adler
2023-02-17 17:50:21 +00:00
committed by GitHub
parent a79f4a095d
commit 19ae411f05
2 changed files with 18 additions and 4 deletions
+1 -1
View File
@@ -182,7 +182,7 @@ func WebsocketCloseSprintf(format string, vars ...any) string {
if len(msg) > websocketCloseMaxLen {
// Trim the string to 123 bytes. If we accidentally cut in the middle of
// a UTF-8 character, remove it from the string.
return strings.ToValidUTF8(string(msg[123]), "")
return strings.ToValidUTF8(msg[:websocketCloseMaxLen], "")
}
return msg