This is an automated email from the ASF dual-hosted git repository. vatamane pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit caaf84a626670ac3fe206c60186e7186202d60ed Author: Karthikeya1500 <[email protected]> AuthorDate: Wed Mar 25 10:59:34 2026 +0530 Fix ReferenceError in QuickJS dispatch If an unrecognized command is processed by globalThis.dispatch, the error handler attempts to reference cmdkey without it being defined. This throws a ReferenceError instead of generating the intended CouchDB fatal error array. This commit assigns cmd.shift() to a const variable cmdkey before evaluating the switch statement. --- share/server/dispatch-quickjs.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/share/server/dispatch-quickjs.js b/share/server/dispatch-quickjs.js index 5f69f6188..2f05118b3 100644 --- a/share/server/dispatch-quickjs.js +++ b/share/server/dispatch-quickjs.js @@ -154,7 +154,8 @@ globalThis.dispatch = function(line) { const cmd = JSON.parse(line); State.line_length = line.length; try { - switch (cmd.shift()) { + const cmdkey = cmd.shift(); + switch (cmdkey) { case "ddoc": DDoc.ddoc.apply(null, cmd); break;
