Defect #11191 » redmine_attachment_charset_issue.diff
| app/models/mail_handler.rb 2013-06-03 16:29:44.457817160 +0200 | ||
|---|---|---|
|
# add To and Cc as watchers before saving so the watchers can reply to Redmine
|
||
|
add_watchers(issue)
|
||
|
issue.save!
|
||
|
add_attachments(issue)
|
||
|
issue.save!
|
||
|
logger.info "MailHandler: issue ##{issue.id} created by #{user}" if logger && logger.info
|
||
|
issue
|
||
|
end
|
||
| ... | ... | |
|
def add_attachments(obj)
|
||
|
if email.attachments && email.attachments.any?
|
||
|
part = email.text_part || email.html_part || email
|
||
|
email.attachments.each do |attachment|
|
||
|
logger.info "MailHandler: attachment found"
|
||
|
obj.attachments << Attachment.create(:container => obj,
|
||
|
:file => attachment.decoded,
|
||
|
:filename => attachment.filename,
|
||
|
:filename => Redmine::CodesetUtil.to_utf8(attachment.filename, part.charset),
|
||
|
:author => user,
|
||
|
:content_type => attachment.mime_type)
|
||
|
end
|
||
| ... | ... | |
|
end
|
||
|
def cleaned_up_subject
|
||
|
subject = email.subject.to_s
|
||
|
part = email.text_part || email.html_part || email
|
||
|
subject = email.subject
|
||
|
subject = Redmine::CodesetUtil.to_utf8(subject, part.charset)
|
||
|
subject.strip[0,255]
|
||
|
end
|
||
| ... | ... | |
|
addr, name = from, nil
|
||
|
if m = from.match(/^"?(.+?)"?\s+<(.+@.+)>$/)
|
||
|
addr, name = m[2], m[1]
|
||
|
part = email.text_part || email.html_part || email
|
||
|
name = Redmine::CodesetUtil.to_utf8(name, part.charset)
|
||
|
end
|
||
|
if addr.present?
|
||
|
user = self.class.new_user_from_attributes(addr, name)
|
||
- « Previous
- 1
- 2
- 3
- Next »