fix: gofmt/gocylo leftover from old PR (#610)

This commit is contained in:
James Read 2025-06-22 21:42:57 +01:00 committed by GitHub
parent 1ffdd93ddf
commit e38361f3d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 27 additions and 27 deletions

View File

@ -81,6 +81,7 @@ func parseActionArguments(values map[string]string, action *config.Action, entit
return parsedShellCommand, nil return parsedShellCommand, nil
} }
//gocyclo:ignore
func redactShellCommand(shellCommand string, arguments []config.ActionArgument, argumentValues map[string]string) string { func redactShellCommand(shellCommand string, arguments []config.ActionArgument, argumentValues map[string]string) string {
for _, arg := range arguments { for _, arg := range arguments {
if arg.Type == "password" { if arg.Type == "password" {
@ -237,22 +238,24 @@ func typeSafetyCheckUrl(value string) error {
} }
func mangleInvalidArgumentValues(req *ExecutionRequest) { func mangleInvalidArgumentValues(req *ExecutionRequest) {
mangleInvalidDatetimeValues(req)
}
func mangleInvalidDatetimeValues(req *ExecutionRequest) {
for _, arg := range req.Action.Arguments { for _, arg := range req.Action.Arguments {
if arg.Type == "datetime" { if arg.Type == "datetime" {
mangleInvalidDatetimeValues(req, &arg)
}
}
}
func mangleInvalidDatetimeValues(req *ExecutionRequest, arg *config.ActionArgument) {
value, exists := req.Arguments[arg.Name] value, exists := req.Arguments[arg.Name]
if !exists || value == "" { if !exists || value == "" {
continue return
} }
timestamp, err := time.Parse("2006-01-02T15:04", value) timestamp, err := time.Parse("2006-01-02T15:04", value)
if err == nil { if err == nil {
log.WithFields(log.Fields { log.WithFields(log.Fields{
"arg": arg.Name, "arg": arg.Name,
"value": value, "value": value,
"actionTitle": req.Action.Title, "actionTitle": req.Action.Title,
@ -260,7 +263,4 @@ func mangleInvalidDatetimeValues(req *ExecutionRequest) {
req.Arguments[arg.Name] = timestamp.Format("2006-01-02T15:04:05") req.Arguments[arg.Name] = timestamp.Format("2006-01-02T15:04:05")
} }
}
}
} }