Skip to content
This repository was archived by the owner on Mar 19, 2025. It is now read-only.

Commit 298691b

Browse files
authored
Merge pull request #1 from Scompler/fix-date-converting
Fix crash when date without timezone
2 parents c9046a2 + 86e2036 commit 298691b

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

lib/mapi/convert/note-mime.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def populate_headers
3535
# headers, i think because one recipient was external. the only place the senders email address
3636
# exists is in the transport headers. so its maybe not good to overwrite from.
3737
# recipients however usually have smtp address available.
38-
# maybe we'll do it for all addresses that are smtp? (is that equivalent to
38+
# maybe we'll do it for all addresses that are smtp? (is that equivalent to
3939
# sender_email_address !~ /^\//
4040
name, email = props.sender_name, props.sender_email_address
4141
if props.sender_addrtype == 'SMTP'
@@ -105,7 +105,7 @@ def populate_headers
105105
# i have no timezone info anyway.
106106
# in gmail, i see stuff like 15 Jan 2007 00:48:19 -0000, and it displays as 11:48.
107107
# can also add .localtime here if desired. but that feels wrong.
108-
headers['Date'] = [Time.iso8601(time.to_s).rfc2822] if time
108+
headers['Date'] = [time.rfc2822] if time
109109
end
110110

111111
# some very simplistic mapping between internet message headers and the
@@ -266,9 +266,8 @@ def populate_headers
266266
# can employ other methods for getting a time. heres one in a similar vein to msgconvert.pl,
267267
# ie taking the time from an ole object
268268
time = @root.ole.dirents.map { |dirent| dirent.modify_time || dirent.create_time }.compact.sort.last
269-
headers['Date'] = [Time.iso8601(time.to_s).rfc2822] if time
269+
headers['Date'] = [time.rfc2822] if time
270270
end
271271
end
272272
end
273273
end
274-

lib/mapi/convert/note-tmail.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def populate_headers
4545
# headers, i think because one recipient was external. the only place the senders email address
4646
# exists is in the transport headers. so its maybe not good to overwrite from.
4747
# recipients however usually have smtp address available.
48-
# maybe we'll do it for all addresses that are smtp? (is that equivalent to
48+
# maybe we'll do it for all addresses that are smtp? (is that equivalent to
4949
# sender_email_address !~ /^\//
5050
name, email = props.sender_name, props.sender_email_address
5151
if props.sender_addrtype == 'SMTP'
@@ -115,7 +115,7 @@ def populate_headers
115115
# i have no timezone info anyway.
116116
# in gmail, i see stuff like 15 Jan 2007 00:48:19 -0000, and it displays as 11:48.
117117
# can also add .localtime here if desired. but that feels wrong.
118-
headers['Date'] = [Time.iso8601(time.to_s).rfc2822] if time
118+
headers['Date'] = [time.rfc2822] if time
119119
end
120120

121121
# some very simplistic mapping between internet message headers and the
@@ -279,9 +279,8 @@ def populate_headers
279279
# can employ other methods for getting a time. heres one in a similar vein to msgconvert.pl,
280280
# ie taking the time from an ole object
281281
time = @root.ole.dirents.map { |dirent| dirent.modify_time || dirent.create_time }.compact.sort.last
282-
headers['Date'] = [Time.iso8601(time.to_s).rfc2822] if time
282+
headers['Date'] = [time.rfc2822] if time
283283
end
284284
end
285285
end
286286
end
287-

0 commit comments

Comments
 (0)