mirror of
https://github.com/mjl-/mox.git
synced 2024-12-25 16:03:48 +03:00
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.
This commit is contained in:
parent
6d38a1e9a4
commit
ecf6163409
1 changed files with 2 additions and 2 deletions
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue