diff options
author | Simon Ser <contact@emersion.fr> | 2019-12-09 13:45:15 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2019-12-09 13:45:15 +0100 |
commit | 61ffc105fd8480b0af4151e3fadb0751d38bea82 (patch) | |
tree | 352011041a9c9e6a4db3b8ed8a072e5c117bc7b3 | |
parent | d1d43809577f85d2feec4bc61601ca9ade378b5b (diff) | |
download | alps-61ffc105fd8480b0af4151e3fadb0751d38bea82.tar.gz alps-61ffc105fd8480b0af4151e3fadb0751d38bea82.zip |
Use imap.BodyStructure.Filename and imap.Address.Address
The former fixes encoding issues in filenames. The latter is just for
brevity.
-rw-r--r-- | go.mod | 2 | ||||
-rw-r--r-- | go.sum | 2 | ||||
-rw-r--r-- | handlers.go | 2 | ||||
-rw-r--r-- | imap.go | 5 |
4 files changed, 5 insertions, 6 deletions
@@ -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 @@ -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= diff --git a/handlers.go b/handlers.go index 21873a7..4615aa4 100644 --- a/handlers.go +++ b/handlers.go @@ -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 @@ -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, |