consistently use store.CloseRemoveTempFile for closing and removing temp files

This commit is contained in:
Mechiel Lukkien
2025-03-01 08:43:53 +01:00
parent b822533df3
commit 3050baa15a
2 changed files with 3 additions and 14 deletions

View File

@ -6,7 +6,6 @@ import (
"errors"
"fmt"
"io"
"log/slog"
"os"
"path/filepath"
"strconv"
@ -270,11 +269,7 @@ func (mr *MaildirReader) Next() (*Message, *os.File, string, error) {
}
defer func() {
if f != nil {
name := f.Name()
err := f.Close()
mr.log.Check(err, "closing temporary message file after maildir read error")
err = os.Remove(name)
mr.log.Check(err, "removing temporary message file after maildir read error", slog.String("path", name))
CloseRemoveTempFile(mr.log, f, "maildir temp message file")
}
}()