merges main into feat-whatsapp

This commit is contained in:
Abhinav Raut
2026-06-20 21:46:37 +05:30
171 changed files with 6997 additions and 2658 deletions
+15 -2
View File
@@ -10,7 +10,7 @@ import (
"strings"
"time"
"github.com/k3a/html2text"
"github.com/jaytaylor/html2text"
)
const (
@@ -31,9 +31,22 @@ func NormalizeWhatsAppPhone(s string) string {
return waPhoneFormatting.Replace(s)
}
// SanitizeUTF8 removes NUL bytes and replaces invalid UTF-8 byte sequences with the Unicode replacement character.
func SanitizeUTF8(s string) string {
if s == "" {
return s
}
s = strings.ReplaceAll(s, "\x00", "")
return strings.ToValidUTF8(s, "�")
}
// HTML2Text converts HTML to text.
func HTML2Text(html string) string {
return strings.TrimSpace(html2text.HTML2Text(html))
out, err := html2text.FromString(html, html2text.Options{TextOnly: true})
if err != nil {
return ""
}
return strings.TrimSpace(out)
}
// SanitizeFilename sanitizes the provided filename.