whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [whimsy] branch master updated: WHIMSY-214 Secretary workbench message date can be wrong
Date Tue, 18 Dec 2018 15:18:52 GMT
This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new ac6f234  WHIMSY-214 Secretary workbench message date can be wrong
ac6f234 is described below

commit ac6f234ffc11f96b98121ecacef5fac23b85de8b
Author: Sebb <sebb@apache.org>
AuthorDate: Tue Dec 18 14:57:04 2018 +0000

    WHIMSY-214 Secretary workbench message date can be wrong
---
 tools/deliver.rb                   | 6 ++----
 www/secretary/workbench/deliver.rb | 2 +-
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/tools/deliver.rb b/tools/deliver.rb
index 55db717..5cb11c3 100644
--- a/tools/deliver.rb
+++ b/tools/deliver.rb
@@ -3,7 +3,6 @@
 #
 
 require 'digest'
-require 'time'
 require 'fileutils'
 
 MAIL_ROOT = '/srv/mail'
@@ -22,14 +21,13 @@ mail = STDIN.read.force_encoding('binary')
 
 # extract info
 dest = mail[/^List-Id: <(.*)>/, 1] || mail[/^Delivered-To.* (\S+)\s*$/, 1] || 'unknown'
-time = Time.parse(mail[/^Date: (.*)/, 1]) rescue Time.now
+month = Time.now.strftime('%Y%m')
 hash = Digest::SHA1.hexdigest(getmid(mail) || mail)[0..9]
 
 # build file name
-file = "#{MAIL_ROOT}/#{dest[/^[-\w]+/]}/#{time.strftime("%Y%m")}/#{hash}"
+file = "#{MAIL_ROOT}/#{dest[/^[-\w]+/]}/#{month}/#{hash}"
 
 File.umask 0002
 FileUtils.mkdir_p File.dirname(file)
 File.write file, mail, encoding: Encoding::BINARY
-File.utime time, time, file
 File.chmod 0644, file
diff --git a/www/secretary/workbench/deliver.rb b/www/secretary/workbench/deliver.rb
index e329da9..7a7cc74 100644
--- a/www/secretary/workbench/deliver.rb
+++ b/www/secretary/workbench/deliver.rb
@@ -24,7 +24,7 @@ rescue => e
 end
 
 # construct message
-month = (Time.parse(headers[:time]) rescue Time.now).strftime('%Y%m')
+month = Time.now.strftime('%Y%m')
 mailbox = Mailbox.new(month)
 message = Message.new(mailbox, hash, headers, email)
 


Mime
View raw message