IRCReader: trim \r if the line ending was \r\n
For parity with (*bufio.Reader).ReadLine(), which does the same
This commit is contained in:
parent
2c4b83d648
commit
98ea36235a
@ -63,6 +63,10 @@ func (cc *IRCReader) ReadLine() ([]byte, error) {
|
||||
line := cc.buf[cc.start : cc.searchFrom+nlidx]
|
||||
cc.start = cc.searchFrom + nlidx + 1
|
||||
cc.searchFrom = cc.start
|
||||
// treat \r\n as the line terminator if it was present
|
||||
if 0 < len(line) && line[len(line)-1] == '\r' {
|
||||
line = line[:len(line)-1]
|
||||
}
|
||||
return line, nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user