More efficient is digit check

Also fixes the previous check allowing trailing newlines
This commit is contained in:
Kovid Goyal 2026-09-01 20:59:31 +05:30
parent 35f88faeea
commit 57bb144d96
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -1726,10 +1726,10 @@ class Window:
def handle_remote_echo(self, msg: memoryview) -> None:
# This is used by the ssh kitten to flush garbage from the tty on exit
data = base64_decode(msg)
if re.match(rb'\d+$', data) is None:
log_error(f'Invalid echo message received from client: {data!r}')
else:
if data.isdigit():
self.write_to_child(data)
else:
log_error(f'Invalid echo message received from client: {data!r}')
def handle_remote_ssh(self, msg: memoryview) -> None:
from kittens.ssh.utils import get_ssh_data