@@ -1,6 +1,6 | |||||
1 | source 'http://rubygems.org' |
|
1 | source 'http://rubygems.org' | |
2 |
|
2 | |||
3 |
gem |
|
3 | gem "rails", "3.2.13" | |
4 | gem "jquery-rails", "~> 2.0.2" |
|
4 | gem "jquery-rails", "~> 2.0.2" | |
5 | gem "i18n", "~> 0.6.0" |
|
5 | gem "i18n", "~> 0.6.0" | |
6 | gem "coderay", "~> 1.0.6" |
|
6 | gem "coderay", "~> 1.0.6" | |
@@ -79,7 +79,7 group :test do | |||||
79 | platforms = [:mri_19] |
|
79 | platforms = [:mri_19] | |
80 | platforms << :jruby if defined?(JRUBY_VERSION) && JRUBY_VERSION >= "1.7" |
|
80 | platforms << :jruby if defined?(JRUBY_VERSION) && JRUBY_VERSION >= "1.7" | |
81 | gem "test-unit", :platforms => platforms |
|
81 | gem "test-unit", :platforms => platforms | |
82 |
gem "mocha", " |
|
82 | gem "mocha", "~> 0.13.3" | |
83 | end |
|
83 | end | |
84 |
|
84 | |||
85 | local_gemfile = File.join(File.dirname(__FILE__), "Gemfile.local") |
|
85 | local_gemfile = File.join(File.dirname(__FILE__), "Gemfile.local") |
@@ -249,26 +249,9 class MailHandler < ActionMailer::Base | |||||
249 | def add_attachments(obj) |
|
249 | def add_attachments(obj) | |
250 | if email.attachments && email.attachments.any? |
|
250 | if email.attachments && email.attachments.any? | |
251 | email.attachments.each do |attachment| |
|
251 | email.attachments.each do |attachment| | |
252 | filename = attachment.filename |
|
|||
253 | unless filename.respond_to?(:encoding) |
|
|||
254 | # try to reencode to utf8 manually with ruby1.8 |
|
|||
255 | h = attachment.header['Content-Disposition'] |
|
|||
256 | unless h.nil? |
|
|||
257 | begin |
|
|||
258 | if m = h.value.match(/filename\*[0-9\*]*=([^=']+)'/) |
|
|||
259 | filename = Redmine::CodesetUtil.to_utf8(filename, m[1]) |
|
|||
260 | elsif m = h.value.match(/filename=.*=\?([^\?]+)\?[BbQq]\?/) |
|
|||
261 | # http://tools.ietf.org/html/rfc2047#section-4 |
|
|||
262 | filename = Redmine::CodesetUtil.to_utf8(filename, m[1]) |
|
|||
263 | end |
|
|||
264 | rescue |
|
|||
265 | # nop |
|
|||
266 | end |
|
|||
267 | end |
|
|||
268 | end |
|
|||
269 | obj.attachments << Attachment.create(:container => obj, |
|
252 | obj.attachments << Attachment.create(:container => obj, | |
270 | :file => attachment.decoded, |
|
253 | :file => attachment.decoded, | |
271 | :filename => filename, |
|
254 | :filename => attachment.filename, | |
272 | :author => user, |
|
255 | :author => user, | |
273 | :content_type => attachment.mime_type) |
|
256 | :content_type => attachment.mime_type) | |
274 | end |
|
257 | end | |
@@ -391,19 +374,6 class MailHandler < ActionMailer::Base | |||||
391 |
|
374 | |||
392 | def cleaned_up_subject |
|
375 | def cleaned_up_subject | |
393 | subject = email.subject.to_s |
|
376 | subject = email.subject.to_s | |
394 | unless subject.respond_to?(:encoding) |
|
|||
395 | # try to reencode to utf8 manually with ruby1.8 |
|
|||
396 | begin |
|
|||
397 | if h = email.header[:subject] |
|
|||
398 | # http://tools.ietf.org/html/rfc2047#section-4 |
|
|||
399 | if m = h.value.match(/=\?([^\?]+)\?[BbQq]\?/) |
|
|||
400 | subject = Redmine::CodesetUtil.to_utf8(subject, m[1]) |
|
|||
401 | end |
|
|||
402 | end |
|
|||
403 | rescue |
|
|||
404 | # nop |
|
|||
405 | end |
|
|||
406 | end |
|
|||
407 | subject.strip[0,255] |
|
377 | subject.strip[0,255] | |
408 | end |
|
378 | end | |
409 |
|
379 |
General Comments 0
You need to be logged in to leave comments.
Login now