Skip to content

Commit

Permalink
perf: 更新shell脚本模板,规避使用eval带来的不可预期的风险 TencentBlueKing#2992
Browse files Browse the repository at this point in the history
  • Loading branch information
hLinx committed Jun 12, 2024
1 parent 3804e86 commit f9648c4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/frontend/src/components/ace-editor/default-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ export default {
'function job_success',
'{',
' local msg="$*"',
' echo "$(job_get_now) job_success: [$msg]"',
' echo "$(job_get_now) job_success:[$msg]"',
' exit 0',
'}',
'',
lang === 'zh-CN' ? '# 在脚本执行失败的逻辑分支处调用,打印当前的时间戳及PID' : '# Call this function when the script execution fails to print the current time and PID with a failure message',
'function job_fail',
'{',
' local msg="$*"',
' echo "$(job_get_now) job_fail: [$msg]"',
' echo "$(job_get_now) job_fail:[$msg]"',
' exit 1',
'}',
'',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -568,9 +568,9 @@
this.strategy = strategy;
if (strategy === 'once') {
this.$refs.timeTaskForm.clearError('cronExpression');
this.formData.executeTime = generatorDefaultCronTime();
this.formData.executeTime = this.formData.executeTime || generatorDefaultCronTime();
} else {
this.formData.cronExpression = '* * * * *';
this.formData.cronExpression = this.formData.cronExpression || '* * * * *';
}
this.formData.endTime = '';
this.formData.notifyChannel = [];
Expand Down

0 comments on commit f9648c4

Please sign in to comment.