mirror of
https://github.com/ergochat/ergo.git
synced 2025-12-20 02:00:11 -08:00
fix #1151
This commit is contained in:
parent
4cadb7ad58
commit
a4f9e08a85
11 changed files with 45 additions and 6 deletions
|
|
@ -77,6 +77,9 @@ func (cc *IRCStreamConn) ReadLine() (line []byte, err error) {
|
|||
return nil, errReadQ
|
||||
}
|
||||
line = bytes.TrimSuffix(line, crlf)
|
||||
if globalUtf8EnforcementSetting && !utf8.Valid(line) {
|
||||
err = errInvalidUtf8
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -101,9 +104,9 @@ func (wc IRCWSConn) UnderlyingConn() *utils.WrappedConn {
|
|||
|
||||
func (wc IRCWSConn) WriteLine(buf []byte) (err error) {
|
||||
buf = bytes.TrimSuffix(buf, crlf)
|
||||
// there's not much we can do about this;
|
||||
// silently drop the message
|
||||
if !utf8.Valid(buf) {
|
||||
if !globalUtf8EnforcementSetting && !utf8.Valid(buf) {
|
||||
// there's not much we can do about this;
|
||||
// silently drop the message
|
||||
return nil
|
||||
}
|
||||
return wc.conn.WriteMessage(websocket.TextMessage, buf)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue