mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 14:13:29 +00:00
Fix regex exclude chars logic
https://github.com/webmin/webmin/pull/1776#discussion_r1017431635
This commit is contained in:
@@ -117,12 +117,15 @@ Net::WebSocket::Server->new(
|
||||
exit(0);
|
||||
}
|
||||
if ($wsconn) {
|
||||
# Do not print commands to display, if start from two
|
||||
# consecutive spaces and ends with return char. This
|
||||
# regex only catches commands sent in one shot using
|
||||
# socket.send(' command\r') call, i.e. it won't work
|
||||
# if command is pasted or typed in a normal way
|
||||
$buf =~ s/^[\s]{2}\S+.*[\r\n]+[\e]\[\?2004l[\n]*//;
|
||||
# Do not print commands to display, if start from two and more spaces
|
||||
# and ends with return char. Number of preceding spaces should equal
|
||||
# the length of a command being executed. This regex only catches
|
||||
# commands sent in one shot using socket.send(' ls\r') call, i.e.
|
||||
# it won't work if command is pasted or typed in a normal way
|
||||
if ($buf =~ /^([\s]{2,})(\S+.*)[\r\n]+[\e]\[\?2004l[\n]*/) {
|
||||
$buf =~ s/^[\s]{2,}\S+.*[\r\n]+[\e]\[\?2004l[\n]*//
|
||||
if (length($1) == length($2));
|
||||
}
|
||||
$wsconn->send_binary($buf);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user