From a3f69e248a48aa40b40e197a55f5f17e94254ee2 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 10 May 2009 08:40:51 +0000 Subject: Merged r2718 from trunk (#3291). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.8-stable@2719 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/tasks/migrate_from_trac.rake | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/tasks/migrate_from_trac.rake b/lib/tasks/migrate_from_trac.rake index ce54359ad..1fef49ca1 100644 --- a/lib/tasks/migrate_from_trac.rake +++ b/lib/tasks/migrate_from_trac.rake @@ -565,12 +565,14 @@ namespace :redmine do page.attachments.each do |attachment| next unless attachment.exist? next if p.attachments.find_by_filename(attachment.filename.gsub(/^.*(\\|\/)/, '').gsub(/[^\w\.\-]/,'_')) #add only once per page - a = Attachment.new :created_on => attachment.time - a.file = attachment - a.author = find_or_create_user(attachment.author) - a.description = attachment.description - a.container = p - migrated_wiki_attachments += 1 if a.save + attachment.open { + a = Attachment.new :created_on => attachment.time + a.file = attachment + a.author = find_or_create_user(attachment.author) + a.description = attachment.description + a.container = p + migrated_wiki_attachments += 1 if a.save + } end end -- cgit v1.2.3