fix: strip markdown hard-break backslashes from webhook payloads (#13950)

This commit is contained in:
Sivin Varghese
2026-04-16 13:19:35 +05:30
committed by GitHub
parent b5264a2560
commit 48533e2a5d
7 changed files with 73 additions and 2 deletions

View File

@@ -0,0 +1,10 @@
# Strips CommonMark hard line breaks from stored markdown source (backslash before newline).
# ProseMirror / the dashboard editor emits this form so soft breaks survive as markdown;
# webhook consumers expect plain newlines without a visible backslash (e.g. WhatsApp gateways).
class Messages::WebhookContentNormalizer
def self.normalize(text)
return text if text.blank?
text.gsub(/\\\r?\n/, "\n")
end
end