@@ -1,6 +1,6 | |||
|
1 | 1 | source 'https://rubygems.org' |
|
2 | 2 | |
|
3 |
gem |
|
|
3 | gem "rails", "3.2.13" | |
|
4 | 4 | gem "jquery-rails", "~> 2.0.2" |
|
5 | 5 | gem "i18n", "~> 0.6.0" |
|
6 | 6 | gem "coderay", "~> 1.0.6" |
@@ -78,7 +78,7 end | |||
|
78 | 78 | |
|
79 | 79 | group :test do |
|
80 | 80 | gem "shoulda", "~> 3.3.2" |
|
81 | gem "mocha" | |
|
81 | gem "mocha", "~> 0.13.3" | |
|
82 | 82 | gem 'capybara', '~> 2.0.0' |
|
83 | 83 | end |
|
84 | 84 |
@@ -254,26 +254,9 class MailHandler < ActionMailer::Base | |||
|
254 | 254 | def add_attachments(obj) |
|
255 | 255 | if email.attachments && email.attachments.any? |
|
256 | 256 | email.attachments.each do |attachment| |
|
257 | filename = attachment.filename | |
|
258 | unless filename.respond_to?(:encoding) | |
|
259 | # try to reencode to utf8 manually with ruby1.8 | |
|
260 | h = attachment.header['Content-Disposition'] | |
|
261 | unless h.nil? | |
|
262 | begin | |
|
263 | if m = h.value.match(/filename\*[0-9\*]*=([^=']+)'/) | |
|
264 | filename = Redmine::CodesetUtil.to_utf8(filename, m[1]) | |
|
265 | elsif m = h.value.match(/filename=.*=\?([^\?]+)\?[BbQq]\?/) | |
|
266 | # http://tools.ietf.org/html/rfc2047#section-4 | |
|
267 | filename = Redmine::CodesetUtil.to_utf8(filename, m[1]) | |
|
268 | end | |
|
269 | rescue | |
|
270 | # nop | |
|
271 | end | |
|
272 | end | |
|
273 | end | |
|
274 | 257 | obj.attachments << Attachment.create(:container => obj, |
|
275 | 258 | :file => attachment.decoded, |
|
276 | :filename => filename, | |
|
259 | :filename => attachment.filename, | |
|
277 | 260 | :author => user, |
|
278 | 261 | :content_type => attachment.mime_type) |
|
279 | 262 | end |
@@ -396,19 +379,6 class MailHandler < ActionMailer::Base | |||
|
396 | 379 | |
|
397 | 380 | def cleaned_up_subject |
|
398 | 381 | subject = email.subject.to_s |
|
399 | unless subject.respond_to?(:encoding) | |
|
400 | # try to reencode to utf8 manually with ruby1.8 | |
|
401 | begin | |
|
402 | if h = email.header[:subject] | |
|
403 | # http://tools.ietf.org/html/rfc2047#section-4 | |
|
404 | if m = h.value.match(/=\?([^\?]+)\?[BbQq]\?/) | |
|
405 | subject = Redmine::CodesetUtil.to_utf8(subject, m[1]) | |
|
406 | end | |
|
407 | end | |
|
408 | rescue | |
|
409 | # nop | |
|
410 | end | |
|
411 | end | |
|
412 | 382 | subject.strip[0,255] |
|
413 | 383 | end |
|
414 | 384 |
General Comments 0
You need to be logged in to leave comments.
Login now