diff --git a/server/template/templateFunctions.go b/server/template/templateFunctions.go index ffcc4d2..3b0288a 100644 --- a/server/template/templateFunctions.go +++ b/server/template/templateFunctions.go @@ -95,8 +95,11 @@ func ParseEmojis(s string) HTML { // Replace shortcodes with corresponding image tags parsedString := regex.ReplaceAllStringFunc(s, func(s string) string { - s = s[1 : len(s)-1] // Get the string inside parentheses - id := emojiList[s] + s = s[1 : len(s)-1] // Get the string inside parentheses + id, found := emojiList[s] // Check if the string has a corresponding emoji ID + if !found { + return fmt.Sprintf("(%s)", s) // No replacement, return the original text + } return fmt.Sprintf(`(%s)`, id, s) })