fix: Properly escape new line characters in webhook (#8054)

This commit is contained in:
Eric Hare
2025-05-15 09:21:58 -07:00
committed by GitHub
parent 30ecf0c77c
commit 952633f4ca

View File

@ -43,7 +43,8 @@ class WebhookComponent(Component):
self.status = "No data provided."
return Data(data={})
try:
body = json.loads(self.data or "{}")
my_data = self.data.replace('"\n"', '"\\n"')
body = json.loads(my_data or "{}")
except json.JSONDecodeError:
body = {"payload": self.data}
message = f"Invalid JSON payload. Please check the format.\n\n{self.data}"