42wim/matterbridge

Mattermost: SendMessage failed: Unsupported start tag

sanpii opened this issue · 2 comments

Describe the bug
A message sends on mattermost 9 is not send to telegram.

To Reproduce
Steps to reproduce the behavior:

  • Sending a message from mattermost to telegram

Expected behavior
The message should appear on telegram.

Screenshots/debug logs

[0016] DEBUG mattermost:   [handleMatter:bridge/mattermost/handlers.go:88] <= Sending message from Sanpï on mattermost.pm to gateway
[0016] DEBUG mattermost:   [handleMatter:bridge/mattermost/handlers.go:89] <= Message is &config.Message{Text:"test", Channel:"mm-channel", Username:"Sanpï", UserID:"1234", Avatar:"", Account:"mattermost.pm", Event:"", Protocol:"", Gateway:"", ParentID:"", Timestamp:time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), ID:"1234", Extra:map[string][]interface {}{}}
[0016] DEBUG gateway:      [SendMessage:gateway/gateway.go:499] => Sending config.Message{Text:"test", Channel:"mm-channel", Username:"Sanpï", UserID:"1234", Avatar:"", Account:"mattermost.pm", Event:"", Protocol:"mattermost", Gateway:"gw-name", ParentID:"", Timestamp:time.Date(2023, time.November, 9, 22, 10, 28, 707318557, time.Local), ID:"1234", Extra:map[string][]interface {}{}} from mattermost.pm (mm-channel) to telegram.secure (t-channel-id)
[0016] DEBUG telegram:     [Send:bridge/telegram/telegram.go:90] => Receiving config.Message{Text:"test", Channel:"t-channel-id", Username:"[mattermost] <Sanpï> ", UserID:"1234", Avatar:"", Account:"mattermost.pm", Event:"", Protocol:"mattermost", Gateway:"gw-name", ParentID:"", Timestamp:time.Date(2023, time.November, 9, 22, 10, 28, 707318557, time.Local), ID:"", Extra:map[string][]interface {}{}}
[0016] DEBUG telegram:     [TGGetParseMode:bridge/telegram/telegram.go:82] Using mode HTML - nick only
[0016] DEBUG gateway:      [func1:gateway/gateway.go:508] => Send from mattermost.pm (mm-channel) to telegram.secure (t-channel-id) took 5.785779ms
[0016] ERROR gateway:      [handleMessage:gateway/handlers.go:228] SendMessage failed: Bad Request: can't parse entities: Unsupported start tag "sanpï" at byte offset 13

Environment (please complete the following information):

  • OS: Ubuntu 20.04.6 LTS
  • Matterbridge version: 1.26.0 6dafebc7
  • Mattermost version: 9.1.1-0

Additional context

It’s the first time I use matterbrigde, maybe I missed something, but the bridge works fine from telegram to mattermost.

[general]
RemoteNickFormat="[{PROTOCOL}] <{NICK}> "

[mattermost]

[mattermost.pm]
Server="example.org:443"
Team="team"
Login="login"
Password="password"
PrefixMessagesWithNick=true
PreserveThreading=true

[telegram]

[telegram.secure]
Token="token"
MessageFormat="HTMLNick"

[[gateway]]
name="gw-name"
enable=true

[[gateway.inout]]
account="telegram.secure"
channel="t-channel-id"

[[gateway.inout]]
account="mattermost.pm"
channel="mm-channel"

same here

[628103] ERROR gateway: SendMessage failed: Bad Request: can't parse entities: Unsupported start tag "laztname" at byte offset 0

I fixed the initial issue by removing MessageFormat="HTMLNick". The </> characters in RemoteNickFormat cause invalid html.