From 3a469d71f240e277d34d0aa988604ef7a836854d Mon Sep 17 00:00:00 2001 From: Ben Coleman Date: Fri, 8 Jul 2022 12:27:40 +0100 Subject: [PATCH] Fixes 400 error empty content from sendgrid Signed-off-by: Ben Coleman --- bindings/twilio/sendgrid/sendgrid.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bindings/twilio/sendgrid/sendgrid.go b/bindings/twilio/sendgrid/sendgrid.go index 558e2923cf..9f20bf242e 100644 --- a/bindings/twilio/sendgrid/sendgrid.go +++ b/bindings/twilio/sendgrid/sendgrid.go @@ -185,7 +185,11 @@ func (sg *SendGrid) Invoke(ctx context.Context, req *bindings.InvokeRequest) (*b } // Email body is held in req.Data, after we tidy it up a bit - emailBody, _ := strconv.Unquote(string(req.Data)) + emailBody, err := strconv.Unquote(string(req.Data)) + if err != nil { + // Unquote will error if the string is not quoted (not exactly graceful!), so fallback using the string as is + emailBody = string(req.Data) + } // Construct email message email := mail.NewV3Mail()