From 86e2036f1a1b9b7eeb7a7abdea7a8054ef6ab6cf Mon Sep 17 00:00:00 2001 From: Pavel Azazel Date: Tue, 9 Nov 2021 15:50:39 +0300 Subject: [PATCH] Fix crash when date without timezone --- lib/mapi/convert/note-mime.rb | 7 +++---- lib/mapi/convert/note-tmail.rb | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/mapi/convert/note-mime.rb b/lib/mapi/convert/note-mime.rb index 7a4d010..8bb08a8 100644 --- a/lib/mapi/convert/note-mime.rb +++ b/lib/mapi/convert/note-mime.rb @@ -35,7 +35,7 @@ def populate_headers # headers, i think because one recipient was external. the only place the senders email address # exists is in the transport headers. so its maybe not good to overwrite from. # recipients however usually have smtp address available. - # maybe we'll do it for all addresses that are smtp? (is that equivalent to + # maybe we'll do it for all addresses that are smtp? (is that equivalent to # sender_email_address !~ /^\// name, email = props.sender_name, props.sender_email_address if props.sender_addrtype == 'SMTP' @@ -105,7 +105,7 @@ def populate_headers # i have no timezone info anyway. # in gmail, i see stuff like 15 Jan 2007 00:48:19 -0000, and it displays as 11:48. # can also add .localtime here if desired. but that feels wrong. - headers['Date'] = [Time.iso8601(time.to_s).rfc2822] if time + headers['Date'] = [time.rfc2822] if time end # some very simplistic mapping between internet message headers and the @@ -266,9 +266,8 @@ def populate_headers # can employ other methods for getting a time. heres one in a similar vein to msgconvert.pl, # ie taking the time from an ole object time = @root.ole.dirents.map { |dirent| dirent.modify_time || dirent.create_time }.compact.sort.last - headers['Date'] = [Time.iso8601(time.to_s).rfc2822] if time + headers['Date'] = [time.rfc2822] if time end end end end - diff --git a/lib/mapi/convert/note-tmail.rb b/lib/mapi/convert/note-tmail.rb index dfb6b28..e45e6aa 100644 --- a/lib/mapi/convert/note-tmail.rb +++ b/lib/mapi/convert/note-tmail.rb @@ -45,7 +45,7 @@ def populate_headers # headers, i think because one recipient was external. the only place the senders email address # exists is in the transport headers. so its maybe not good to overwrite from. # recipients however usually have smtp address available. - # maybe we'll do it for all addresses that are smtp? (is that equivalent to + # maybe we'll do it for all addresses that are smtp? (is that equivalent to # sender_email_address !~ /^\// name, email = props.sender_name, props.sender_email_address if props.sender_addrtype == 'SMTP' @@ -115,7 +115,7 @@ def populate_headers # i have no timezone info anyway. # in gmail, i see stuff like 15 Jan 2007 00:48:19 -0000, and it displays as 11:48. # can also add .localtime here if desired. but that feels wrong. - headers['Date'] = [Time.iso8601(time.to_s).rfc2822] if time + headers['Date'] = [time.rfc2822] if time end # some very simplistic mapping between internet message headers and the @@ -279,9 +279,8 @@ def populate_headers # can employ other methods for getting a time. heres one in a similar vein to msgconvert.pl, # ie taking the time from an ole object time = @root.ole.dirents.map { |dirent| dirent.modify_time || dirent.create_time }.compact.sort.last - headers['Date'] = [Time.iso8601(time.to_s).rfc2822] if time + headers['Date'] = [time.rfc2822] if time end end end end -