From 3f71f9acdb0111edaec3f5fa4dd576fd53052602 Mon Sep 17 00:00:00 2001 From: whyour Date: Sun, 29 Sep 2024 22:27:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=BB=E5=8A=A1=E5=91=BD?= =?UTF-8?q?=E4=BB=A4=E5=B8=A6=E6=9C=89=20-m=20=E5=8F=82=E6=95=B0=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E6=97=A5=E5=BF=97=E7=9B=AE=E5=BD=95=E7=94=9F=E6=88=90?= =?UTF-8?q?=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/config/util.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/back/config/util.ts b/back/config/util.ts index 1c0bb0fd..e5aa24c7 100644 --- a/back/config/util.ts +++ b/back/config/util.ts @@ -469,13 +469,18 @@ export async function getUniqPath( command: string, id: string, ): Promise { + let suffix = ''; if (/^\d+$/.test(id)) { - id = `_${id}`; - } else { - id = ''; + suffix = `_${id}`; + } + + let items = command.split(/ +/); + + const maxTimeCommandIndex = items.findIndex((x) => x === '-m'); + if (maxTimeCommandIndex !== -1) { + items = items.slice(maxTimeCommandIndex + 2); } - const items = command.split(/ +/); let str = items[0]; if (items[0] === TASK_COMMAND) { str = items[1]; @@ -499,7 +504,7 @@ export async function getUniqPath( str = `${tempStr}_${str.slice(slashIndex + 1)}`; } - return `${str}${id}`; + return `${str}${suffix}`; } export function safeJSONParse(value?: string) {