fix(actions): webhook json double escaping (#189)

This commit is contained in:
Kyle Sanderson 2022-03-21 09:20:04 -07:00 committed by GitHub
parent a966291b38
commit de1291d110
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,7 +3,6 @@ package action
import ( import (
"bytes" "bytes"
"crypto/tls" "crypto/tls"
"encoding/json"
"io" "io"
"net/http" "net/http"
"os" "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("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) 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{ t := &http.Transport{
TLSClientConfig: &tls.Config{ TLSClientConfig: &tls.Config{
InsecureSkipVerify: true, 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} 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 { if err != nil {
log.Error().Err(err).Msgf("webhook client request error: %v", action.WebhookHost) log.Error().Err(err).Msgf("webhook client request error: %v", action.WebhookHost)
return return