From d3a11606f03c6b4c2e3cb07ad6a870190bf19d87 Mon Sep 17 00:00:00 2001 From: Jakub Jankiewicz Date: Sat, 16 Nov 2024 14:07:09 +0100 Subject: [PATCH] ignore empty command in Pipe extension #984 --- CHANGELOG.md | 1 + js/pipe.js | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ba1606f..5bd81653 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Bugfix * fix `terminal::login()` when user already authenticated [#980](https://github.com/jcubic/jquery.terminal/issues/980) * improve mobile support +* ignore empty command in Pipe extension [#984](https://github.com/jcubic/jquery.terminal/issues/984) ## 2.44.1 ### Bugfix diff --git a/js/pipe.js b/js/pipe.js index e6f42933..e731ca46 100644 --- a/js/pipe.js +++ b/js/pipe.js @@ -330,6 +330,9 @@ } // ------------------------------------------------------------------------------- function stringify(cmd) { + if (!cmd.name) { + return ''; + } return cmd.name + ' ' + cmd.args.map(function(arg, i) { if (cmd.args_quotes[i]) { var quote = cmd.args_quotes[i]; @@ -393,10 +396,12 @@ name: cmd.name, completion: Object.keys(interpreter[cmd.name]) }); - } else if (is_function(term_settings.onCommandNotFound)) { - term_settings.onCommandNotFound.call(term, command, term); - } else { - error(sprintf(strings(term).commandNotFound, cmd.name)); + } else if (cmd.name) { + if (is_function(term_settings.onCommandNotFound)) { + term_settings.onCommandNotFound.call(term, command, term); + } else { + error(sprintf(strings(term).commandNotFound, cmd.name)); + } } } else { //term = term.duplicate();