webssh

Web based ssh client https://github.com/huashengdun/webssh webssh.huashengdun.org/
git clone http://git.hanabi.in/repos/webssh.git
Log | Files | Refs | README | LICENSE

commit 5f4978a9949e99a3bb180b4d150ec5e480e988d3
parent 795875807b1c89580a19b54850fb0373904fc8e6
Author: Sheng <webmaster0115@gmail.com>
Date:   Sun, 22 Mar 2020 14:40:49 +0800

Set utf-8 as the default encoding if we cannot detect it

Diffstat:
Mwebssh/handler.py | 16++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/webssh/handler.py b/webssh/handler.py @@ -427,12 +427,16 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler): ] for command in commands: - _, stdout, _ = ssh.exec_command(command, get_pty=True) - data = stdout.read() - logging.debug('{!r} => {!r}'.format(command, data)) - result = self.parse_encoding(data) - if result: - return result + try: + _, stdout, _ = ssh.exec_command(command, get_pty=True) + except paramiko.SSHException as exc: + logging.info(str(exc)) + else: + data = stdout.read() + logging.debug('{!r} => {!r}'.format(command, data)) + result = self.parse_encoding(data) + if result: + return result logging.warn('Could not detect the default ecnoding.') return 'utf-8'