mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-28 05:29:25 +01:00
Irc.send: safeguard against newlines in input!
This commit is contained in:
parent
070bba77cb
commit
e54e17a0ea
3
main.py
3
main.py
@ -75,6 +75,9 @@ class Irc():
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def send(self, data):
|
def send(self, data):
|
||||||
|
# Safeguard against newlines in input!! Otherwise, each line gets
|
||||||
|
# treated as a separate command, which is particularly nasty.
|
||||||
|
data = data.replace('\n', ' ')
|
||||||
data = data.encode("utf-8") + b"\n"
|
data = data.encode("utf-8") + b"\n"
|
||||||
log.debug("-> %s", data.decode("utf-8").strip("\n"))
|
log.debug("-> %s", data.decode("utf-8").strip("\n"))
|
||||||
self.socket.send(data)
|
self.socket.send(data)
|
||||||
|
Loading…
Reference in New Issue
Block a user