Thumbnail

rani/matterbridge.git

Clone URL: https://git.buni.party/rani/matterbridge.git

commit 42bba14a2eec099d2bcf4b7cdbc42e668e1f39e5 Author: Qais Patankar <qaisjp@gmail.com> Date: Sat Apr 25 13:22:22 2020 +0000 Fix #1120: replaceAction "_" crash (discord) (#1121) diff --git a/bridge/discord/helpers.go b/bridge/discord/helpers.go index 00592f3..e183165 100644 --- a/bridge/discord/helpers.go +++ b/bridge/discord/helpers.go @@ -1888 +1889 @@ func replaceEmotes(text string) string {  }    func (b *Bdiscord) replaceAction(text string) (string, bool) { - if strings.HasPrefix(text, "_") && strings.HasSuffix(text, "_") { - return text[1 : len(text)-1], true + length := len(text) + if length > 1 && text[0] == '_' && text[length-1] == '_' { + return text[1 : length-1], true   }   return text, false  }