Fix to color normalization end tag in ssh.

Initial fix in #1243 does not account for empty string.
Addresses a potential problem similar to IndexError in telnet.py #1306
This commit is contained in:
BlauFeuer 2017-04-17 04:22:56 -04:00 committed by Griatch
parent f7955340a7
commit 154799f6e0

View file

@ -283,7 +283,7 @@ class SshProtocol(Manhole, session.Session):
else:
# we need to make sure to kill the color at the end in order
# to match the webclient output.
linetosend = ansi.parse_ansi(_RE_N.sub("", text) + ("|n" if text[-1] != "|" else "||n"),
linetosend = ansi.parse_ansi(_RE_N.sub("", text) + ("||n" if text.endswith("|") else "|n"),
strip_ansi=nocolor, xterm256=xterm256, mxp=False)
self.sendLine(linetosend)