diff --git a/gossamer_forums.rb b/gossamer_forums.rb index 3ce201c..a5efebc 100644 --- a/gossamer_forums.rb +++ b/gossamer_forums.rb @@ -1,5 +1,5 @@ # gossamer threads migration-import code -# v0.22 +# v0.22.1 require 'mysql2' require 'open-uri' @@ -350,6 +350,7 @@ class GossamerForumsImporter < ImportScripts::Base def handle_post_attachments(gossamer_post_id, post, user_id) execute_query("SELECT * FROM gforum_PostAttachment WHERE post_id_fk = #{gossamer_post_id}").each do |att_row| attachment_url = "https://forum.slowtwitch.com/forum/?do=post_attachment;postatt_id=#{att_row['postatt_id']}" + puts "Handling attachment: #{attachment_url}" attachment_data = download_attachment(attachment_url) next unless attachment_data @@ -358,11 +359,14 @@ class GossamerForumsImporter < ImportScripts::Base temp_file.binmode temp_file.write(attachment_data) temp_file.rewind - + + puts "Attempting upload..." upload = upload_attachment(user_id, temp_file, att_row['postatt_filename'], attachment_url) next unless upload upload_url = upload.url + + puts "Appending to post.raw... #{upload_url} MIME type: #{mime_type}" if mime_type.start_with?('image/') post.raw += "\n![#{att_row['postatt_filename']}](#{upload_url})" else