Use imap.BodyStructure.Filename and imap.Address.Address
The former fixes encoding issues in filenames. The latter is just for brevity.
This commit is contained in:
parent
d1d4380957
commit
61ffc105fd
4 changed files with 5 additions and 6 deletions
2
go.mod
2
go.mod
|
@ -3,7 +3,7 @@ module git.sr.ht/~emersion/koushin
|
|||
go 1.13
|
||||
|
||||
require (
|
||||
github.com/emersion/go-imap v1.0.1
|
||||
github.com/emersion/go-imap v1.0.3-0.20191208103636-6388a8c8bfdb
|
||||
github.com/emersion/go-message v0.10.8
|
||||
github.com/emersion/go-sasl v0.0.0-20190817083125-240c8404624e
|
||||
github.com/emersion/go-smtp v0.12.0
|
||||
|
|
2
go.sum
2
go.sum
|
@ -5,6 +5,8 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumC
|
|||
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
||||
github.com/emersion/go-imap v1.0.1 h1:J3duplefIrglQtE63hCGYdGLgMjYWqHvkUUEbimbXY8=
|
||||
github.com/emersion/go-imap v1.0.1/go.mod h1:MEiDDwwQFcZ+L45Pa68jNGv0qU9kbW+SJzwDpvSfX1s=
|
||||
github.com/emersion/go-imap v1.0.3-0.20191208103636-6388a8c8bfdb h1:WSeLbrNhAgjH21BVHUqtfhwX4Rnr31rvMi0Us6m5iWg=
|
||||
github.com/emersion/go-imap v1.0.3-0.20191208103636-6388a8c8bfdb/go.mod h1:TjT+1ncDso8j/VXeUHcZeQknho5hjyQLqEIybJJjjDI=
|
||||
github.com/emersion/go-message v0.10.4-0.20190609165112-592ace5bc1ca h1:OYhqtJI4eOLvGtRIsUfP87VMJ1J/o6ks1tah9DlYkn4=
|
||||
github.com/emersion/go-message v0.10.4-0.20190609165112-592ace5bc1ca/go.mod h1:3h+HsGTCFHmk4ngJ2IV/YPhdlaOcR6hcgqM3yca9v7c=
|
||||
github.com/emersion/go-message v0.10.8 h1:1l1Vb+0By9U1ITTH3FgKfJQWQ9sTI3N1smPe6SS3QXY=
|
||||
|
|
|
@ -229,7 +229,7 @@ func handleCompose(ectx echo.Context) error {
|
|||
if len(replyTo) > 0 {
|
||||
msg.To = make([]string, len(replyTo))
|
||||
for i, to := range replyTo {
|
||||
msg.To[i] = to.MailboxName + "@" + to.HostName
|
||||
msg.To[i] = to.Address()
|
||||
}
|
||||
}
|
||||
msg.Subject = inReplyTo.Envelope.Subject
|
||||
|
|
5
imap.go
5
imap.go
|
@ -174,10 +174,7 @@ func imapPartTree(bs *imap.BodyStructure, path []int) *IMAPPartNode {
|
|||
path = []int{1}
|
||||
}
|
||||
|
||||
var filename string
|
||||
if strings.EqualFold(bs.Disposition, "attachment") {
|
||||
filename = bs.DispositionParams["filename"]
|
||||
}
|
||||
filename, _ := bs.Filename()
|
||||
|
||||
node := &IMAPPartNode{
|
||||
Path: path,
|
||||
|
|
Loading…
Reference in a new issue