MCPcopy Create free account
hub / github.com/gogs/gogs / SlackShortTextFormatter

Function SlackShortTextFormatter

internal/database/webhook_slack.go:57–64  ·  view source on GitHub ↗
(s string)

Source from the content-addressed store, hash-verified

55}
56
57func SlackShortTextFormatter(s string) string {
58 s = strings.Split(s, "\n")[0]
59 // replace & < >
60 s = strings.ReplaceAll(s, "&", "&amp;")
61 s = strings.ReplaceAll(s, "<", "&lt;")
62 s = strings.ReplaceAll(s, ">", "&gt;")
63 return s
64}
65
66func SlackLinkFormatter(url, text string) string {
67 return fmt.Sprintf("<%s|%s>", url, SlackTextFormatter(text))

Callers 1

getSlackPushPayloadFunction · 0.85

Calls 2

SplitMethod · 0.80
ReplaceAllMethod · 0.80

Tested by

no test coverage detected