diff --git a/gossamer_forums.rb b/gossamer_forums.rb index 9b13e44..1b59d7e 100644 --- a/gossamer_forums.rb +++ b/gossamer_forums.rb @@ -1,5 +1,5 @@ # gossamer threads migration-import code -# v0.25.8 +# v0.26 require 'mysql2' require 'open-uri' @@ -372,10 +372,13 @@ class GossamerForumsImporter < ImportScripts::Base # retain_hours: nil ) - # Move the file to the correct location - upload_path = Upload.get_path_for_file(upload.sha1) - FileUtils.mkdir_p(File.dirname(upload_path)) - FileUtils.mv(file.path, upload_path) + # Use Discourse's internal method to upload the file + file.rewind + Discourse.store.upload(file, upload.sha1) + +# # Move the file to the correct location +# upload_path = Upload.get_path_for_file(upload.sha1) +# FileUtils.mkdir_p(File.dirname(upload_path)) # FileUtils.mv(file.path, upload.path) upload.save!