From ecf6163409542ed6d055fd581f96fe5aec25d0df Mon Sep 17 00:00:00 2001 From: Mechiel Lukkien Date: Tue, 2 Apr 2024 20:04:09 +0200 Subject: [PATCH] improve previous about using mtime from imported maildir message files don't treat just any number from filename as timestamp. require it has 2 dots. prevents filenames with just a number as being seen as a timestamp, like when you import files from a mox accounts msgs directory. --- store/import.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/store/import.go b/store/import.go index c5514b2..f77e116 100644 --- a/store/import.go +++ b/store/import.go @@ -309,8 +309,8 @@ func (mr *MaildirReader) Next() (*Message, *os.File, string, error) { // Take received time from filename, falling back to mtime for maildirs // reconstructed some other sources of message files. var received time.Time - t := strings.SplitN(filepath.Base(sf.Name()), ".", 2) - if v, err := strconv.ParseInt(t[0], 10, 64); err == nil { + t := strings.SplitN(filepath.Base(sf.Name()), ".", 3) + if v, err := strconv.ParseInt(t[0], 10, 64); len(t) == 3 && err == nil { received = time.Unix(v, 0) } else if fi, err := sf.Stat(); err == nil { received = fi.ModTime()