summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Faughnan <tom@tjf.sh>2022-08-20 03:46:24 -0400
committerRobin Jarry <robin@jarry.cc>2022-08-22 15:46:56 +0200
commit5ed849688af7206a4b1cc325d19c9d6a8c8c7e4f (patch)
treec7919d915aa8cba5d555b6f07a787aa7e31cabeb
parentc98f70487417825ca592c928cbf0144ba88eef7e (diff)
downloadaerc-5ed849688af7206a4b1cc325d19c9d6a8c8c7e4f.tar.gz
aerc-5ed849688af7206a4b1cc325d19c9d6a8c8c7e4f.zip
parse: remove trailing whitespace from rfc1123z regex
When there is no Date header in a message, aerc falls back to the Received header and tries to extract an rfc1123z date from it (introduced in commit d1600e46). The current regex for extracting the date incorrectly allows for trailing whitespace, causing time.Parse() to fail inside of parseReceivedHeader(). As a result, the message's date is shown as "???????????????????" in the message list and as "0000-12-31 07:03 PM" in the message view (the latter is likely related to the zero value of time.Time). Steps to reproduce: 1) Send yourself a message with no Date header, e.g. with msmtp: printf 'Subject: foo bar\n\nbody text\n' | msmtp --set-date-header=off me@example.com 2) Note the message's displayed date in aerc's message list and message view. Signed-off-by: Thomas Faughnan <tom@tjf.sh> Acked-by: Robin Jarry <robin@jarry.cc>
-rw-r--r--worker/lib/parse.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/worker/lib/parse.go b/worker/lib/parse.go
index 7f6eb20f..30d06a98 100644
--- a/worker/lib/parse.go
+++ b/worker/lib/parse.go
@@ -19,7 +19,7 @@ import (
// RFC 1123Z regexp
var dateRe = regexp.MustCompile(`(((Mon|Tue|Wed|Thu|Fri|Sat|Sun))[,]?\s[0-9]{1,2})\s` +
`(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s` +
- `([0-9]{4})\s([0-9]{2}):([0-9]{2})(:([0-9]{2}))?\s([\+|\-][0-9]{4})\s?`)
+ `([0-9]{4})\s([0-9]{2}):([0-9]{2})(:([0-9]{2}))?\s([\+|\-][0-9]{4})`)
func FetchEntityPartReader(e *message.Entity, index []int) (io.Reader, error) {
if len(index) == 0 {