Skip to content

Commit

Permalink
refactor: convert task script line endings (ccfos#1717)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuweizzz authored Oct 9, 2023
1 parent 320401e commit d099e6b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions center/router/router_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ func (f *taskForm) Verify() error {
if f.Script == "" {
return fmt.Errorf("arg(script) is required")
}
f.Script = strings.Replace(f.Script, "\r\n", "\n", -1)

if str.Dangerous(f.Args) {
return fmt.Errorf("arg(args) is dangerous")
Expand Down
1 change: 1 addition & 0 deletions models/task_tpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ func (t *TaskTpl) CleanFields() error {
if t.Script == "" {
return errors.New("arg(script) is required")
}
t.Script = strings.Replace(t.Script, "\r\n", "\n", -1)

if str.Dangerous(t.Args) {
return errors.New("arg(args) is dangerous")
Expand Down

0 comments on commit d099e6b

Please sign in to comment.