From a57b51af3d2265b34f41f6a06182d4055054f551 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Tue, 26 Dec 2023 20:01:39 +0100 Subject: [PATCH] Allow body to be same as filename if there's a formatted_body for caption --- portal.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/portal.go b/portal.go index e513bd2f..dd9c90f1 100644 --- a/portal.go +++ b/portal.go @@ -647,7 +647,7 @@ func (portal *Portal) convertMatrixMessage(ctx context.Context, sender *User, ev fileName := content.Body var caption string var ranges []*signalpb.BodyRange - if content.FileName != "" && content.Body != content.FileName { + if content.FileName != "" && (content.Body != content.FileName || content.Format == event.FormatHTML) { fileName = content.FileName caption, ranges = matrixfmt.Parse(matrixFormatParams, content) } @@ -707,7 +707,7 @@ func (portal *Portal) convertMatrixMessage(ctx context.Context, sender *User, ev fileName := content.Body var caption string var ranges []*signalpb.BodyRange - if content.FileName != "" && content.Body != content.FileName { + if content.FileName != "" && (content.Body != content.FileName || content.Format == event.FormatHTML) { fileName = content.FileName caption, ranges = matrixfmt.Parse(matrixFormatParams, content) } @@ -729,7 +729,7 @@ func (portal *Portal) convertMatrixMessage(ctx context.Context, sender *User, ev fileName := content.Body var caption string var ranges []*signalpb.BodyRange - if content.FileName != "" && content.Body != content.FileName { + if content.FileName != "" && (content.Body != content.FileName || content.Format == event.FormatHTML) { fileName = content.FileName caption, ranges = matrixfmt.Parse(matrixFormatParams, content) } @@ -760,7 +760,7 @@ func (portal *Portal) convertMatrixMessage(ctx context.Context, sender *User, ev fileName := content.Body var caption string var ranges []*signalpb.BodyRange - if content.FileName != "" && content.Body != content.FileName { + if content.FileName != "" && (content.Body != content.FileName || content.Format == event.FormatHTML) { fileName = content.FileName caption, ranges = matrixfmt.Parse(matrixFormatParams, content) }