summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2013-03-19 06:35:39 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2013-03-19 06:35:39 +0000
commitcc5f59abd40e4ae6cd95ca3fb431ee7da6a46862 (patch)
treedcc12c3e417d552b3cd451e37b64dc15a9fa1720 /app
parentcf1cc08c49f52f2e0d08e75dab8d3100cc41c10a (diff)
downloadredmine-cc5f59abd40e4ae6cd95ca3fb431ee7da6a46862.tar.gz
redmine-cc5f59abd40e4ae6cd95ca3fb431ee7da6a46862.zip
fix broken tests on Rails 3.2.13 with Ruby 1.8 (#12399, #12375)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11650 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/models/mail_handler.rb32
1 files changed, 1 insertions, 31 deletions
diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb
index ecacf4634..0b74c5ac8 100644
--- a/app/models/mail_handler.rb
+++ b/app/models/mail_handler.rb
@@ -254,26 +254,9 @@ class MailHandler < ActionMailer::Base
def add_attachments(obj)
if email.attachments && email.attachments.any?
email.attachments.each do |attachment|
- filename = attachment.filename
- unless filename.respond_to?(:encoding)
- # try to reencode to utf8 manually with ruby1.8
- h = attachment.header['Content-Disposition']
- unless h.nil?
- begin
- if m = h.value.match(/filename\*[0-9\*]*=([^=']+)'/)
- filename = Redmine::CodesetUtil.to_utf8(filename, m[1])
- elsif m = h.value.match(/filename=.*=\?([^\?]+)\?[BbQq]\?/)
- # http://tools.ietf.org/html/rfc2047#section-4
- filename = Redmine::CodesetUtil.to_utf8(filename, m[1])
- end
- rescue
- # nop
- end
- end
- end
obj.attachments << Attachment.create(:container => obj,
:file => attachment.decoded,
- :filename => filename,
+ :filename => attachment.filename,
:author => user,
:content_type => attachment.mime_type)
end
@@ -396,19 +379,6 @@ class MailHandler < ActionMailer::Base
def cleaned_up_subject
subject = email.subject.to_s
- unless subject.respond_to?(:encoding)
- # try to reencode to utf8 manually with ruby1.8
- begin
- if h = email.header[:subject]
- # http://tools.ietf.org/html/rfc2047#section-4
- if m = h.value.match(/=\?([^\?]+)\?[BbQq]\?/)
- subject = Redmine::CodesetUtil.to_utf8(subject, m[1])
- end
- end
- rescue
- # nop
- end
- end
subject.strip[0,255]
end