Socket: Gracefully handle invalid lines with UTF8ONLY

Just skip the line, instead of crashing the whole loop (which
contains the next lines from the same server too)
This commit is contained in:
Valentin Lorentz 2021-09-13 18:45:49 +02:00
parent ee9f0dc1bf
commit 76bd1c89bf

View File

@ -216,7 +216,11 @@ class SocketDriver(drivers.IrcDriver, drivers.ServersMixin):
and 'UTF8ONLY' in self.irc.state.supported: and 'UTF8ONLY' in self.irc.state.supported:
# No need for the fancy charset-guessing used in # No need for the fancy charset-guessing used in
# decode_raw_line. # decode_raw_line.
line = line.decode('utf8') try:
line = line.decode('utf8')
except UnicodeError:
drivers.log.exception('Could not decode line %r', line)
continue
else: else:
line = decode_raw_line(line) line = decode_raw_line(line)