MCPcopy Index your code
hub / github.com/coder/coder / normalizeGoldenEmail

Function normalizeGoldenEmail

coderd/notifications/notifications_test.go:1758–1780  ·  view source on GitHub ↗
(content []byte)

Source from the content-addressed store, hash-verified

1756}
1757
1758func normalizeGoldenEmail(content []byte) []byte {
1759 const (
1760 constantDate = "Fri, 11 Oct 2024 09:03:06 +0000"
1761 constantMessageID = "02ee4935-73be-4fa1-a290-ff9999026b13@blush-whale-48"
1762 constantBoundary = "bbe61b741255b6098bb6b3c1f41b885773df633cb18d2a3002b68e4bc9c4"
1763 )
1764
1765 dateRegex := regexp.MustCompile(`Date: .+`)
1766 messageIDRegex := regexp.MustCompile(`Message-Id: .+`)
1767 boundaryRegex := regexp.MustCompile(`boundary=([0-9a-zA-Z]+)`)
1768 submatches := boundaryRegex.FindSubmatch(content)
1769 if len(submatches) == 0 {
1770 return content
1771 }
1772
1773 boundary := submatches[1]
1774
1775 content = dateRegex.ReplaceAll(content, []byte("Date: "+constantDate))
1776 content = messageIDRegex.ReplaceAll(content, []byte("Message-Id: "+constantMessageID))
1777 content = bytes.ReplaceAll(content, boundary, []byte(constantBoundary))
1778
1779 return content
1780}
1781
1782func normalizeGoldenWebhook(content []byte) []byte {
1783 const constantUUID = "00000000-0000-0000-0000-000000000000"

Callers 1

Calls 1

MustCompileMethod · 0.80

Tested by

no test coverage detected