]> source.dussan.org Git - redmine.git/commitdiff
Same as fix as r2705 from Trac wiki pages attachments (#3291).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 10 May 2009 08:39:23 +0000 (08:39 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 10 May 2009 08:39:23 +0000 (08:39 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2718 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/tasks/migrate_from_trac.rake

index 7ee5c4ece8ca4e68ddfc9025f5a6dda7a333a95d..77d16b7ddcd29c9ed94b81253d41975d8482851d 100644 (file)
@@ -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