diff options
Diffstat (limited to 'worker/notmuch')
-rw-r--r-- | worker/notmuch/message.go | 9 | ||||
-rw-r--r-- | worker/notmuch/worker.go | 1 |
2 files changed, 3 insertions, 7 deletions
diff --git a/worker/notmuch/message.go b/worker/notmuch/message.go index c95c9bac..e39fb17a 100644 --- a/worker/notmuch/message.go +++ b/worker/notmuch/message.go @@ -4,7 +4,6 @@ package notmuch import ( - "bufio" "fmt" "io" "os" @@ -23,16 +22,12 @@ type Message struct { } // NewReader returns a reader for a message -func (m *Message) NewReader() (io.Reader, error) { +func (m *Message) NewReader() (io.ReadCloser, error) { name, err := m.Filename() if err != nil { return nil, err } - f, err := os.Open(name) - if err != nil { - return nil, err - } - return bufio.NewReader(f), nil + return os.Open(name) } // MessageInfo populates a models.MessageInfo struct for the message. diff --git a/worker/notmuch/worker.go b/worker/notmuch/worker.go index 575cd565..d95d6ba3 100644 --- a/worker/notmuch/worker.go +++ b/worker/notmuch/worker.go @@ -367,6 +367,7 @@ func (w *worker) handleFetchFullMessages(msg *types.FetchFullMessages) error { w.w.Logger.Printf("could not get message reader: %v", err) return err } + defer r.Close() w.w.PostMessage(&types.FullMessage{ Message: types.RespondTo(msg), Content: &models.FullMessage{ |