From 6c6661c6c0676b0706018886135bdc08ad9dcb34 Mon Sep 17 00:00:00 2001 From: yczpf2019 Date: Sat, 24 Jan 2026 19:04:00 +0800 Subject: [PATCH] fix: make shell command robust against cached double quotes from frontend --- src/common/shell-micropython.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/common/shell-micropython.js b/src/common/shell-micropython.js index 87af8579..214ef0c5 100755 --- a/src/common/shell-micropython.js +++ b/src/common/shell-micropython.js @@ -15,7 +15,10 @@ export default class ShellMicroPython extends Shell { esptool: `"${PYTHON.path.cli}" "${MICROPYTHON.path.esptool}"`, com: config.port }; - const command = MString.tpl(config.command, info); + // 兼容性处理:移除模板中可能存在的冗余引号 + let cmdTemplate = config.command || ""; + cmdTemplate = cmdTemplate.replace(/"{esptool}"/g, '{esptool}'); + const command = MString.tpl(cmdTemplate, info); console.log('DEBUG CMD BURN:', command); return this.execUntilClosed(command); } @@ -26,7 +29,10 @@ export default class ShellMicroPython extends Shell { ampy: `"${PYTHON.path.cli}" "${MICROPYTHON.path.ampy}"`, com: config.port }; - const command = MString.tpl(config.command, info); + // 兼容性处理:移除模板中可能存在的冗余引号 + let cmdTemplate = config.command || ""; + cmdTemplate = cmdTemplate.replace(/"{ampy}"/g, '{ampy}'); + const command = MString.tpl(cmdTemplate, info); console.log('DEBUG CMD UPLOAD:', command); return this.execUntilClosed(command); }