File tree 3 files changed +8
-3
lines changed
3 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 5
5
"errors"
6
6
"github.com/emersion/go-imap"
7
7
"github.com/emersion/go-imap/client"
8
+ _ "github.com/emersion/go-message/charset"
8
9
"github.com/emersion/go-message/mail"
9
10
"github.com/microcosm-cc/bluemonday"
10
11
"github.com/robfig/cron/v3"
@@ -46,6 +47,13 @@ func getMailBody(p *mail.Part) string {
46
47
body , _ := ioutil .ReadAll (p .Body )
47
48
plainTextBody := strings .Replace (string (body ), "\n " , "\\ n" , - 1 )
48
49
plainTextBody = strings .Replace (plainTextBody , "\r " , "\\ r" , - 1 )
50
+
51
+ regex , err := regexp .Compile (`[^\w] && [\\]` )
52
+ if err != nil {
53
+ log .Fatal (err )
54
+ }
55
+ plainTextBody = regex .ReplaceAllString (plainTextBody , " " )
56
+
49
57
return sanitizePolicy .Sanitize (plainTextBody )
50
58
}
51
59
Original file line number Diff line number Diff line change 5
5
require (
6
6
github.com/emersion/go-imap v1.2.1
7
7
github.com/emersion/go-message v0.15.0
8
- github.com/grokify/html-strip-tags-go v0.0.1
9
8
github.com/microcosm-cc/bluemonday v1.0.19
10
9
github.com/robfig/cron/v3 v3.0.1
11
10
)
Original file line number Diff line number Diff line change @@ -10,8 +10,6 @@ github.com/emersion/go-textwrapper v0.0.0-20200911093747-65d896831594 h1:IbFBtwo
10
10
github.com/emersion/go-textwrapper v0.0.0-20200911093747-65d896831594 /go.mod h1:aqO8z8wPrjkscevZJFVE1wXJrLpC5LtJG7fqLOsPb2U =
11
11
github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY =
12
12
github.com/gorilla/css v1.0.0 /go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c =
13
- github.com/grokify/html-strip-tags-go v0.0.1 h1:0fThFwLbW7P/kOiTBs03FsJSV9RM2M/Q/MOnCQxKMo0 =
14
- github.com/grokify/html-strip-tags-go v0.0.1 /go.mod h1:2Su6romC5/1VXOQMaWL2yb618ARB8iVo6/DR99A6d78 =
15
13
github.com/microcosm-cc/bluemonday v1.0.19 h1:OI7hoF5FY4pFz2VA//RN8TfM0YJ2dJcl4P4APrCWy6c =
16
14
github.com/microcosm-cc/bluemonday v1.0.19 /go.mod h1:QNzV2UbLK2/53oIIwTOyLUSABMkjZ4tqiyC1g/DyqxE =
17
15
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs =
You can’t perform that action at this time.
0 commit comments