aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/api_controller.rb6
-rw-r--r--app/models/request_mailer.rb4
2 files changed, 7 insertions, 3 deletions
diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb
index c1156845d..524aa44b7 100644
--- a/app/controllers/api_controller.rb
+++ b/app/controllers/api_controller.rb
@@ -139,11 +139,11 @@ class ApiController < ApplicationController
attachment_hashes = []
(attachments || []).each_with_index do |attachment, i|
filename = File.basename(attachment.original_filename)
- body = attachment.read
- content_type = AlaveteliFileTypes.filename_and_content_to_mimetype(filename, body) || 'application/octet-stream'
+ attachment_body = attachment.read
+ content_type = AlaveteliFileTypes.filename_and_content_to_mimetype(filename, attachment_body) || 'application/octet-stream'
attachment_hashes.push(
:content_type => content_type,
- :body => body,
+ :body => attachment_body,
:filename => filename
)
end
diff --git a/app/models/request_mailer.rb b/app/models/request_mailer.rb
index f7cc088c1..5ea5df802 100644
--- a/app/models/request_mailer.rb
+++ b/app/models/request_mailer.rb
@@ -35,6 +35,10 @@ class RequestMailer < ApplicationMailer
@recipients = info_request.incoming_name_and_email
@body = { :body => body }
+ # ActionMailer only works properly when the time is in the local timezone:
+ # see https://rails.lighthouseapp.com/projects/8994/tickets/3113-actionmailer-only-works-correctly-with-sent_on-times-that-are-in-the-local-time-zone
+ @sent_on = sent_at.dup.localtime
+
attachments.each do |attachment_hash|
attachment attachment_hash
end