Revision 1297:0a574315af3e app/models
| app/models/issue.rb | ||
|---|---|---|
| 418 | 418 |
|
| 419 | 419 |
if attrs['parent_issue_id'].present? |
| 420 | 420 |
s = attrs['parent_issue_id'].to_s |
| 421 |
unless (m = s.match(%r{\A#?(\d+)\z})) && Issue.visible(user).exists?(m[1])
|
|
| 421 |
unless (m = s.match(%r{\A#?(\d+)\z})) && (m[1] == parent_id.to_s || Issue.visible(user).exists?(m[1]))
|
|
| 422 | 422 |
@invalid_parent_issue_id = attrs.delete('parent_issue_id')
|
| 423 | 423 |
end |
| 424 | 424 |
end |
| app/models/mail_handler.rb | ||
|---|---|---|
| 249 | 249 |
def add_attachments(obj) |
| 250 | 250 |
if email.attachments && email.attachments.any? |
| 251 | 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 | 252 |
obj.attachments << Attachment.create(:container => obj, |
| 270 | 253 |
:file => attachment.decoded, |
| 271 |
:filename => filename, |
|
| 254 |
:filename => attachment.filename,
|
|
| 272 | 255 |
:author => user, |
| 273 | 256 |
:content_type => attachment.mime_type) |
| 274 | 257 |
end |
| ... | ... | |
| 391 | 374 |
|
| 392 | 375 |
def cleaned_up_subject |
| 393 | 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 | 377 |
subject.strip[0,255] |
| 408 | 378 |
end |
| 409 | 379 |
|
| app/models/project.rb | ||
|---|---|---|
| 751 | 751 |
def copy_wiki(project) |
| 752 | 752 |
# Check that the source project has a wiki first |
| 753 | 753 |
unless project.wiki.nil? |
| 754 |
self.wiki ||= Wiki.new
|
|
| 754 |
wiki = self.wiki || Wiki.new
|
|
| 755 | 755 |
wiki.attributes = project.wiki.attributes.dup.except("id", "project_id")
|
| 756 | 756 |
wiki_pages_map = {}
|
| 757 | 757 |
project.wiki.pages.each do |page| |
| ... | ... | |
| 763 | 763 |
wiki.pages << new_wiki_page |
| 764 | 764 |
wiki_pages_map[page.id] = new_wiki_page |
| 765 | 765 |
end |
| 766 |
|
|
| 767 |
self.wiki = wiki |
|
| 766 | 768 |
wiki.save |
| 767 | 769 |
# Reproduce page hierarchy |
| 768 | 770 |
project.wiki.pages.each do |page| |
Also available in: Unified diff