From de1291d110489e1a7cc0537000c8925b8c30f8a8 Mon Sep 17 00:00:00 2001 From: Kyle Sanderson Date: Mon, 21 Mar 2022 09:20:04 -0700 Subject: [PATCH] fix(actions): webhook json double escaping (#189) --- internal/action/run.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/internal/action/run.go b/internal/action/run.go index 4310bb4..fa6ee57 100644 --- a/internal/action/run.go +++ b/internal/action/run.go @@ -3,7 +3,6 @@ package action import ( "bytes" "crypto/tls" - "encoding/json" "io" "net/http" "os" @@ -279,12 +278,6 @@ func (s *service) webhook(action domain.Action, release domain.Release) { log.Trace().Msgf("action WEBHOOK: '%v' file: %v", action.Name, release.TorrentName) log.Trace().Msgf("webhook action '%v' - host: %v data: %v", action.Name, action.WebhookHost, action.WebhookData) - jsonData, err := json.Marshal(dataArgs) - if err != nil { - log.Error().Err(err).Msgf("webhook client could not marshal data: %v", action.WebhookHost) - return - } - t := &http.Transport{ TLSClientConfig: &tls.Config{ InsecureSkipVerify: true, @@ -293,7 +286,7 @@ func (s *service) webhook(action domain.Action, release domain.Release) { client := http.Client{Transport: t, Timeout: 15 * time.Second} - req, err := http.NewRequest(http.MethodPost, action.WebhookHost, bytes.NewBuffer(jsonData)) + req, err := http.NewRequest(http.MethodPost, action.WebhookHost, bytes.NewBufferString(dataArgs)) if err != nil { log.Error().Err(err).Msgf("webhook client request error: %v", action.WebhookHost) return