From e9d42e02a273b4813925d2ec0f5928c65b21aee1 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Fri, 26 Feb 2021 03:10:30 -0500 Subject: [PATCH] simplify utf8 validation of incoming WS lines As of #1483, websockets entail enforce-utf8, so there's no need to check globalUTF8EnforcementSetting when handling websockets. --- irc/ircconn.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/irc/ircconn.go b/irc/ircconn.go index 0a424608..a84fdec8 100644 --- a/irc/ircconn.go +++ b/irc/ircconn.go @@ -126,10 +126,8 @@ func (wc IRCWSConn) WriteLines(buffers [][]byte) (err error) { func (wc IRCWSConn) ReadLine() (line []byte, err error) { messageType, line, err := wc.conn.ReadMessage() if err == nil { - if messageType == websocket.BinaryMessage && globalUtf8EnforcementSetting { - if !utf8.Valid(line) { - return line, errInvalidUtf8 - } + if messageType == websocket.BinaryMessage && !utf8.Valid(line) { + return line, errInvalidUtf8 } return line, nil } else if err == websocket.ErrReadLimit {