From 4d754673e72992cb5fca32d684ad9794c14671d4 Mon Sep 17 00:00:00 2001 From: wxip <3455781820@qq.com> Date: Fri, 24 May 2024 15:28:35 +0800 Subject: [PATCH] fix: args is not iterable --- frontend/src/utils/decoder_cmd.js | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/frontend/src/utils/decoder_cmd.js b/frontend/src/utils/decoder_cmd.js index e4d33f3..a9034bd 100644 --- a/frontend/src/utils/decoder_cmd.js +++ b/frontend/src/utils/decoder_cmd.js @@ -13,19 +13,21 @@ export const joinCommand = (path, args = [], emptyContent = '-') => { if (!isEmpty(path)) { let containValuePlaceholder = false cmd = includes(path, ' ') ? `"${path}"` : path - for (let part of args) { - part = trim(part) - if (isEmpty(part)) { - continue - } - if (includes(part, ' ')) { - cmd += ' "' + part + '"' - } else { - if (toUpper(part) === '{VALUE}') { - part = '{VALUE}' - containValuePlaceholder = true + if (args) { + for (let part of args) { + part = trim(part) + if (isEmpty(part)) { + continue + } + if (includes(part, ' ')) { + cmd += ' "' + part + '"' + } else { + if (toUpper(part) === '{VALUE}') { + part = '{VALUE}' + containValuePlaceholder = true + } + cmd += ' ' + part } - cmd += ' ' + part } } if (!containValuePlaceholder) {