Defect #11191 » redmine_attachment_charset_issue.diff
app/models/mail_handler.rb 2013-06-03 16:29:44.457817160 +0200 | ||
---|---|---|
180 | 180 |
# add To and Cc as watchers before saving so the watchers can reply to Redmine |
181 | 181 |
add_watchers(issue) |
182 |
issue.save! |
|
183 | 182 |
add_attachments(issue) |
183 |
issue.save! |
|
184 | 184 |
logger.info "MailHandler: issue ##{issue.id} created by #{user}" if logger && logger.info |
185 | 185 |
issue |
186 | 186 |
end |
... | ... | |
253 | 253 |
def add_attachments(obj) |
254 | 254 |
if email.attachments && email.attachments.any? |
255 |
part = email.text_part || email.html_part || email |
|
255 | 256 |
email.attachments.each do |attachment| |
257 |
logger.info "MailHandler: attachment found" |
|
256 | 258 |
obj.attachments << Attachment.create(:container => obj, |
257 | 259 |
:file => attachment.decoded, |
258 |
:filename => attachment.filename,
|
|
260 |
:filename => Redmine::CodesetUtil.to_utf8(attachment.filename, part.charset),
|
|
259 | 261 |
:author => user, |
260 | 262 |
:content_type => attachment.mime_type) |
261 | 263 |
end |
... | ... | |
378 | 380 |
end |
379 | 381 |
def cleaned_up_subject |
380 |
subject = email.subject.to_s |
|
382 |
part = email.text_part || email.html_part || email |
|
383 |
subject = email.subject |
|
384 |
subject = Redmine::CodesetUtil.to_utf8(subject, part.charset) |
|
381 | 385 |
subject.strip[0,255] |
382 | 386 |
end |
... | ... | |
426 | 430 |
addr, name = from, nil |
427 | 431 |
if m = from.match(/^"?(.+?)"?\s+<(.+@.+)>$/) |
428 | 432 |
addr, name = m[2], m[1] |
433 |
part = email.text_part || email.html_part || email |
|
434 |
name = Redmine::CodesetUtil.to_utf8(name, part.charset) |
|
429 | 435 |
end |
430 | 436 |
if addr.present? |
431 | 437 |
user = self.class.new_user_from_attributes(addr, name) |
- « Previous
- 1
- 2
- 3
- Next »