Skip to content

Commit

Permalink
Allow body to be same as filename if there's a formatted_body for cap…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
tulir committed Dec 26, 2023
1 parent 38e0c5f commit a57b51a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions portal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit a57b51a

Please sign in to comment.