From 2eb05bcee243dd6bd3b1cd3eb7a8290692744f0f Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Tue, 29 Nov 2022 10:40:27 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E9=80=9A=E7=94=A8=E5=8A=9F=E8=83=BD):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1=E8=BE=93?= =?UTF-8?q?=E5=85=A5=E9=94=99=E8=AF=AF=E8=A1=A8=E8=BE=BE=E5=BC=8F=E5=8F=8D?= =?UTF-8?q?=E8=A7=A3=E6=9E=90=E9=A1=B5=E9=9D=A2=E5=B4=A9=E6=BA=83=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1020403 --user=赵勇 [接口测试]github #20262定时任务Cron表达式导致页面崩溃 https://www.tapd.cn/55049933/s/1307046 --- framework/sdk-parent/frontend/package.json | 7 ++++--- framework/sdk-parent/frontend/src/utils/cron.js | 7 +++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/framework/sdk-parent/frontend/package.json b/framework/sdk-parent/frontend/package.json index da01a8df9d..6e9cf041b9 100644 --- a/framework/sdk-parent/frontend/package.json +++ b/framework/sdk-parent/frontend/package.json @@ -19,20 +19,21 @@ "@fortawesome/free-solid-svg-icons": "^5.15.2", "@fortawesome/vue-fontawesome": "^2.0.2", "axios": "^0.27.2", + "cron-parser": "^4.7.0", "element-ui": ">2.15.9 || 2.15.8", "fit2cloud-ui": "^1.8.0", "js-cookie": "^2.2.1", "jsencrypt": "^3.1.0", + "jsondiffpatch": "^0.4.1", + "mavon-editor": "2.10.4", "normalize.css": "^8.0.1", "nprogress": "^0.2.0", "pinia": "^2.0.14", "pinia-plugin-persistedstate": "^1.6.3", - "mavon-editor": "2.10.4", "qiankun": "^2.8.0", "vue": "^2.7.3", "vue-i18n": "^8.22.4", - "vuedraggable": "^2.24.3", - "jsondiffpatch": "^0.4.1" + "vuedraggable": "^2.24.3" }, "devDependencies": { "@babel/core": "^7.12.16", diff --git a/framework/sdk-parent/frontend/src/utils/cron.js b/framework/sdk-parent/frontend/src/utils/cron.js index a97ac2c357..bfb2438f61 100644 --- a/framework/sdk-parent/frontend/src/utils/cron.js +++ b/framework/sdk-parent/frontend/src/utils/cron.js @@ -1,3 +1,5 @@ +import parser from "cron-parser"; + /** * Validates a cron expression. * @@ -5,6 +7,11 @@ * @return True is expression is valid */ export function cronValidate(cronExpression ){ + try { + parser.parseExpression(cronExpression); + } catch (e) { + return false; + } if (!cronExpression) { return false;